Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java Tue Jan 22 07:09:45 2013 @@ -33,11 +33,11 @@ public class StopWatchTest { //----------------------------------------------------------------------- @Test public void testStopWatchSimple(){ - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); watch.start(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.stop(); - long time = watch.getTime(); + final long time = watch.getTime(); assertEquals(time, watch.getTime()); assertTrue(time >= 500); @@ -49,28 +49,28 @@ public class StopWatchTest { @Test public void testStopWatchSimpleGet(){ - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); assertEquals(0, watch.getTime()); assertEquals("0:00:00.000", watch.toString()); watch.start(); - try {Thread.sleep(500);} catch (InterruptedException ex) {} + try {Thread.sleep(500);} catch (final InterruptedException ex) {} assertTrue(watch.getTime() < 2000); } @Test public void testStopWatchSplit(){ - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); watch.start(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.split(); - long splitTime = watch.getSplitTime(); - String splitStr = watch.toSplitString(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + final long splitTime = watch.getSplitTime(); + final String splitStr = watch.toSplitString(); + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.unsplit(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.stop(); - long totalTime = watch.getTime(); + final long totalTime = watch.getTime(); assertEquals("Formatted split string not the correct length", splitStr.length(), 11); @@ -82,16 +82,16 @@ public class StopWatchTest { @Test public void testStopWatchSuspend(){ - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); watch.start(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.suspend(); - long suspendTime = watch.getTime(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + final long suspendTime = watch.getTime(); + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.resume(); - try {Thread.sleep(550);} catch (InterruptedException ex) {} + try {Thread.sleep(550);} catch (final InterruptedException ex) {} watch.stop(); - long totalTime = watch.getTime(); + final long totalTime = watch.getTime(); assertTrue(suspendTime >= 500); assertTrue(suspendTime < 700); @@ -101,60 +101,60 @@ public class StopWatchTest { @Test public void testLang315() { - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); watch.start(); - try {Thread.sleep(200);} catch (InterruptedException ex) {} + try {Thread.sleep(200);} catch (final InterruptedException ex) {} watch.suspend(); - long suspendTime = watch.getTime(); - try {Thread.sleep(200);} catch (InterruptedException ex) {} + final long suspendTime = watch.getTime(); + try {Thread.sleep(200);} catch (final InterruptedException ex) {} watch.stop(); - long totalTime = watch.getTime(); + final long totalTime = watch.getTime(); assertTrue( suspendTime == totalTime ); } // test bad states @Test public void testBadStates() { - StopWatch watch = new StopWatch(); + final StopWatch watch = new StopWatch(); try { watch.stop(); fail("Calling stop on an unstarted StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.stop(); fail("Calling stop on an unstarted StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.suspend(); fail("Calling suspend on an unstarted StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.split(); fail("Calling split on a non-running StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.unsplit(); fail("Calling unsplit on an unsplit StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.resume(); fail("Calling resume on an unsuspended StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } @@ -163,28 +163,28 @@ public class StopWatchTest { try { watch.start(); fail("Calling start on a started StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.unsplit(); fail("Calling unsplit on an unsplit StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.getSplitTime(); fail("Calling getSplitTime on an unsplit StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } try { watch.resume(); fail("Calling resume on an unsuspended StopWatch should throw an exception. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } @@ -193,33 +193,33 @@ public class StopWatchTest { try { watch.start(); fail("Calling start on a stopped StopWatch should throw an exception as it needs to be reset. "); - } catch(IllegalStateException ise) { + } catch(final IllegalStateException ise) { // expected } } @Test public void testGetStartTime() { - long beforeStopWatch = System.currentTimeMillis(); - StopWatch watch = new StopWatch(); + final long beforeStopWatch = System.currentTimeMillis(); + final StopWatch watch = new StopWatch(); try { watch.getStartTime(); fail("Calling getStartTime on an unstarted StopWatch should throw an exception"); - } catch (IllegalStateException expected) { + } catch (final IllegalStateException expected) { // expected } watch.start(); try { watch.getStartTime(); Assert.assertTrue(watch.getStartTime() >= beforeStopWatch); - } catch (IllegalStateException ex) { + } catch (final IllegalStateException ex) { fail("Start time should be available: " + ex.getMessage()); } watch.reset(); try { watch.getStartTime(); fail("Calling getStartTime on a reset, but unstarted StopWatch should throw an exception"); - } catch (IllegalStateException expected) { + } catch (final IllegalStateException expected) { // expected } }
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutablePairTest.java Tue Jan 22 07:09:45 2013 @@ -36,12 +36,12 @@ public class ImmutablePairTest { @Test public void testBasic() throws Exception { - ImmutablePair<Integer, String> pair = new ImmutablePair<Integer, String>(0, "foo"); + final ImmutablePair<Integer, String> pair = new ImmutablePair<Integer, String>(0, "foo"); assertEquals(0, pair.left.intValue()); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.right); assertEquals("foo", pair.getRight()); - ImmutablePair<Object, String> pair2 = new ImmutablePair<Object, String>(null, "bar"); + final ImmutablePair<Object, String> pair2 = new ImmutablePair<Object, String>(null, "bar"); assertNull(pair2.left); assertNull(pair2.getLeft()); assertEquals("bar", pair2.right); @@ -50,12 +50,12 @@ public class ImmutablePairTest { @Test public void testPairOf() throws Exception { - ImmutablePair<Integer, String> pair = ImmutablePair.of(0, "foo"); + final ImmutablePair<Integer, String> pair = ImmutablePair.of(0, "foo"); assertEquals(0, pair.left.intValue()); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.right); assertEquals("foo", pair.getRight()); - ImmutablePair<Object, String> pair2 = ImmutablePair.of(null, "bar"); + final ImmutablePair<Object, String> pair2 = ImmutablePair.of(null, "bar"); assertNull(pair2.left); assertNull(pair2.getLeft()); assertEquals("bar", pair2.right); @@ -68,7 +68,7 @@ public class ImmutablePairTest { assertFalse(ImmutablePair.of("foo", 0).equals(ImmutablePair.of("foo", null))); assertFalse(ImmutablePair.of("foo", "bar").equals(ImmutablePair.of("xyz", "bar"))); - ImmutablePair<String, String> p = ImmutablePair.of("foo", "bar"); + final ImmutablePair<String, String> p = ImmutablePair.of("foo", "bar"); assertTrue(p.equals(p)); assertFalse(p.equals(new Object())); } @@ -89,11 +89,11 @@ public class ImmutablePairTest { @Test @SuppressWarnings("unchecked") public void testSerialization() throws Exception { - ImmutablePair<Integer, String> origPair = ImmutablePair.of(0, "foo"); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); + final ImmutablePair<Integer, String> origPair = ImmutablePair.of(0, "foo"); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(origPair); - ImmutablePair<Integer, String> deserializedPair = (ImmutablePair<Integer, String>) new ObjectInputStream( + final ImmutablePair<Integer, String> deserializedPair = (ImmutablePair<Integer, String>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); assertEquals(origPair, deserializedPair); assertEquals(origPair.hashCode(), deserializedPair.hashCode()); Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/ImmutableTripleTest.java Tue Jan 22 07:09:45 2013 @@ -36,14 +36,14 @@ public class ImmutableTripleTest { @Test public void testBasic() throws Exception { - ImmutableTriple<Integer, String, Boolean> triple = new ImmutableTriple<Integer, String, Boolean>(0, "foo", Boolean.TRUE); + final ImmutableTriple<Integer, String, Boolean> triple = new ImmutableTriple<Integer, String, Boolean>(0, "foo", Boolean.TRUE); assertEquals(0, triple.left.intValue()); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.middle); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.TRUE, triple.right); assertEquals(Boolean.TRUE, triple.getRight()); - ImmutableTriple<Object, String, Integer> triple2 = new ImmutableTriple<Object, String, Integer>(null, "bar", 42); + final ImmutableTriple<Object, String, Integer> triple2 = new ImmutableTriple<Object, String, Integer>(null, "bar", 42); assertNull(triple2.left); assertNull(triple2.getLeft()); assertEquals("bar", triple2.middle); @@ -54,14 +54,14 @@ public class ImmutableTripleTest { @Test public void testTripleOf() throws Exception { - ImmutableTriple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.FALSE); + final ImmutableTriple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.FALSE); assertEquals(0, triple.left.intValue()); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.middle); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.FALSE, triple.right); assertEquals(Boolean.FALSE, triple.getRight()); - ImmutableTriple<Object, String, Boolean> triple2 = ImmutableTriple.of(null, "bar", Boolean.TRUE); + final ImmutableTriple<Object, String, Boolean> triple2 = ImmutableTriple.of(null, "bar", Boolean.TRUE); assertNull(triple2.left); assertNull(triple2.getLeft()); assertEquals("bar", triple2.middle); @@ -76,7 +76,7 @@ public class ImmutableTripleTest { assertFalse(ImmutableTriple.of("foo", 0, Boolean.TRUE).equals(ImmutableTriple.of("foo", null, null))); assertFalse(ImmutableTriple.of("foo", "bar", "baz").equals(ImmutableTriple.of("xyz", "bar", "blo"))); - ImmutableTriple<String, String, String> p = ImmutableTriple.of("foo", "bar", "baz"); + final ImmutableTriple<String, String, String> p = ImmutableTriple.of("foo", "bar", "baz"); assertTrue(p.equals(p)); assertFalse(p.equals(new Object())); } @@ -100,11 +100,11 @@ public class ImmutableTripleTest { @Test @SuppressWarnings("unchecked") public void testSerialization() throws Exception { - ImmutableTriple<Integer, String, Boolean> origTriple = ImmutableTriple.of(0, "foo", Boolean.TRUE); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); + final ImmutableTriple<Integer, String, Boolean> origTriple = ImmutableTriple.of(0, "foo", Boolean.TRUE); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(origTriple); - ImmutableTriple<Integer, String, Boolean> deserializedTriple = (ImmutableTriple<Integer, String, Boolean>) new ObjectInputStream( + final ImmutableTriple<Integer, String, Boolean> deserializedTriple = (ImmutableTriple<Integer, String, Boolean>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); assertEquals(origTriple, deserializedTriple); assertEquals(origTriple.hashCode(), deserializedTriple.hashCode()); Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutablePairTest.java Tue Jan 22 07:09:45 2013 @@ -36,24 +36,24 @@ public class MutablePairTest { @Test public void testBasic() throws Exception { - MutablePair<Integer, String> pair = new MutablePair<Integer, String>(0, "foo"); + final MutablePair<Integer, String> pair = new MutablePair<Integer, String>(0, "foo"); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.getRight()); - MutablePair<Object, String> pair2 = new MutablePair<Object, String>(null, "bar"); + final MutablePair<Object, String> pair2 = new MutablePair<Object, String>(null, "bar"); assertNull(pair2.getLeft()); assertEquals("bar", pair2.getRight()); } @Test public void testDefault() throws Exception { - MutablePair<Integer, String> pair = new MutablePair<Integer, String>(); + final MutablePair<Integer, String> pair = new MutablePair<Integer, String>(); assertNull(pair.getLeft()); assertNull(pair.getRight()); } @Test public void testMutate() throws Exception { - MutablePair<Integer, String> pair = new MutablePair<Integer, String>(0, "foo"); + final MutablePair<Integer, String> pair = new MutablePair<Integer, String>(0, "foo"); pair.setLeft(42); pair.setRight("bar"); assertEquals(42, pair.getLeft().intValue()); @@ -62,10 +62,10 @@ public class MutablePairTest { @Test public void testPairOf() throws Exception { - MutablePair<Integer, String> pair = MutablePair.of(0, "foo"); + final MutablePair<Integer, String> pair = MutablePair.of(0, "foo"); assertEquals(0, pair.getLeft().intValue()); assertEquals("foo", pair.getRight()); - MutablePair<Object, String> pair2 = MutablePair.of(null, "bar"); + final MutablePair<Object, String> pair2 = MutablePair.of(null, "bar"); assertNull(pair2.getLeft()); assertEquals("bar", pair2.getRight()); } @@ -76,7 +76,7 @@ public class MutablePairTest { assertFalse(MutablePair.of("foo", 0).equals(MutablePair.of("foo", null))); assertFalse(MutablePair.of("foo", "bar").equals(MutablePair.of("xyz", "bar"))); - MutablePair<String, String> p = MutablePair.of("foo", "bar"); + final MutablePair<String, String> p = MutablePair.of("foo", "bar"); assertTrue(p.equals(p)); assertFalse(p.equals(new Object())); } @@ -97,11 +97,11 @@ public class MutablePairTest { @Test @SuppressWarnings("unchecked") public void testSerialization() throws Exception { - MutablePair<Integer, String> origPair = MutablePair.of(0, "foo"); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); + final MutablePair<Integer, String> origPair = MutablePair.of(0, "foo"); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(origPair); - MutablePair<Integer, String> deserializedPair = (MutablePair<Integer, String>) new ObjectInputStream( + final MutablePair<Integer, String> deserializedPair = (MutablePair<Integer, String>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); assertEquals(origPair, deserializedPair); assertEquals(origPair.hashCode(), deserializedPair.hashCode()); Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/MutableTripleTest.java Tue Jan 22 07:09:45 2013 @@ -36,11 +36,11 @@ public class MutableTripleTest { @Test public void testBasic() throws Exception { - MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(0, "foo", Boolean.FALSE); + final MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(0, "foo", Boolean.FALSE); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.FALSE, triple.getRight()); - MutableTriple<Object, String, String> triple2 = new MutableTriple<Object, String, String>(null, "bar", "hello"); + final MutableTriple<Object, String, String> triple2 = new MutableTriple<Object, String, String>(null, "bar", "hello"); assertNull(triple2.getLeft()); assertEquals("bar", triple2.getMiddle()); assertEquals("hello", triple2.getRight()); @@ -48,7 +48,7 @@ public class MutableTripleTest { @Test public void testDefault() throws Exception { - MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(); + final MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(); assertNull(triple.getLeft()); assertNull(triple.getMiddle()); assertNull(triple.getRight()); @@ -56,7 +56,7 @@ public class MutableTripleTest { @Test public void testMutate() throws Exception { - MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(0, "foo", Boolean.TRUE); + final MutableTriple<Integer, String, Boolean> triple = new MutableTriple<Integer, String, Boolean>(0, "foo", Boolean.TRUE); triple.setLeft(42); triple.setMiddle("bar"); triple.setRight(Boolean.FALSE); @@ -67,11 +67,11 @@ public class MutableTripleTest { @Test public void testTripleOf() throws Exception { - MutableTriple<Integer, String, Boolean> triple = MutableTriple.of(0, "foo", Boolean.TRUE); + final MutableTriple<Integer, String, Boolean> triple = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(0, triple.getLeft().intValue()); assertEquals("foo", triple.getMiddle()); assertEquals(Boolean.TRUE, triple.getRight()); - MutableTriple<Object, String, String> triple2 = MutableTriple.of(null, "bar", "hello"); + final MutableTriple<Object, String, String> triple2 = MutableTriple.of(null, "bar", "hello"); assertNull(triple2.getLeft()); assertEquals("bar", triple2.getMiddle()); assertEquals("hello", triple2.getRight()); @@ -84,7 +84,7 @@ public class MutableTripleTest { assertFalse(MutableTriple.of("foo", "bar", "baz").equals(MutableTriple.of("xyz", "bar", "baz"))); assertFalse(MutableTriple.of("foo", "bar", "baz").equals(MutableTriple.of("foo", "bar", "blo"))); - MutableTriple<String, String, String> p = MutableTriple.of("foo", "bar", "baz"); + final MutableTriple<String, String, String> p = MutableTriple.of("foo", "bar", "baz"); assertTrue(p.equals(p)); assertFalse(p.equals(new Object())); } @@ -108,11 +108,11 @@ public class MutableTripleTest { @Test @SuppressWarnings("unchecked") public void testSerialization() throws Exception { - MutableTriple<Integer, String, Boolean> origTriple = MutableTriple.of(0, "foo", Boolean.TRUE); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); + final MutableTriple<Integer, String, Boolean> origTriple = MutableTriple.of(0, "foo", Boolean.TRUE); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(origTriple); - MutableTriple<Integer, String, Boolean> deserializedTriple = (MutableTriple<Integer, String, Boolean>) new ObjectInputStream( + final MutableTriple<Integer, String, Boolean> deserializedTriple = (MutableTriple<Integer, String, Boolean>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); assertEquals(origTriple, deserializedTriple); assertEquals(origTriple.hashCode(), deserializedTriple.hashCode()); Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/PairTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/PairTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/PairTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/PairTest.java Tue Jan 22 07:09:45 2013 @@ -37,11 +37,11 @@ public class PairTest { @Test public void testPairOf() throws Exception { - Pair<Integer, String> pair = Pair.of(0, "foo"); + final Pair<Integer, String> pair = Pair.of(0, "foo"); assertTrue(pair instanceof ImmutablePair<?, ?>); assertEquals(0, ((ImmutablePair<Integer, String>) pair).left.intValue()); assertEquals("foo", ((ImmutablePair<Integer, String>) pair).right); - Pair<Object, String> pair2 = Pair.of(null, "bar"); + final Pair<Object, String> pair2 = Pair.of(null, "bar"); assertTrue(pair2 instanceof ImmutablePair<?, ?>); assertNull(((ImmutablePair<Object, String>) pair2).left); assertEquals("bar", ((ImmutablePair<Object, String>) pair2).right); @@ -49,11 +49,11 @@ public class PairTest { @Test public void testCompatibilityBetweenPairs() throws Exception { - Pair<Integer, String> pair = ImmutablePair.of(0, "foo"); - Pair<Integer, String> pair2 = MutablePair.of(0, "foo"); + final Pair<Integer, String> pair = ImmutablePair.of(0, "foo"); + final Pair<Integer, String> pair2 = MutablePair.of(0, "foo"); assertEquals(pair, pair2); assertEquals(pair.hashCode(), pair2.hashCode()); - HashSet<Pair<Integer, String>> set = new HashSet<Pair<Integer, String>>(); + final HashSet<Pair<Integer, String>> set = new HashSet<Pair<Integer, String>>(); set.add(pair); assertTrue(set.contains(pair2)); @@ -64,18 +64,18 @@ public class PairTest { @Test public void testMapEntry() throws Exception { - Pair<Integer, String> pair = ImmutablePair.of(0, "foo"); - HashMap<Integer, String> map = new HashMap<Integer, String>(); + final Pair<Integer, String> pair = ImmutablePair.of(0, "foo"); + final HashMap<Integer, String> map = new HashMap<Integer, String>(); map.put(0, "foo"); - Entry<Integer, String> entry = map.entrySet().iterator().next(); + final Entry<Integer, String> entry = map.entrySet().iterator().next(); assertEquals(pair, entry); assertEquals(pair.hashCode(), entry.hashCode()); } @Test public void testComparable1() throws Exception { - Pair<String, String> pair1 = Pair.of("A", "D"); - Pair<String, String> pair2 = Pair.of("B", "C"); + final Pair<String, String> pair1 = Pair.of("A", "D"); + final Pair<String, String> pair2 = Pair.of("B", "C"); assertTrue(pair1.compareTo(pair1) == 0); assertTrue(pair1.compareTo(pair2) < 0); assertTrue(pair2.compareTo(pair2) == 0); @@ -84,8 +84,8 @@ public class PairTest { @Test public void testComparable2() throws Exception { - Pair<String, String> pair1 = Pair.of("A", "C"); - Pair<String, String> pair2 = Pair.of("A", "D"); + final Pair<String, String> pair1 = Pair.of("A", "C"); + final Pair<String, String> pair2 = Pair.of("A", "D"); assertTrue(pair1.compareTo(pair1) == 0); assertTrue(pair1.compareTo(pair2) < 0); assertTrue(pair2.compareTo(pair2) == 0); @@ -94,27 +94,27 @@ public class PairTest { @Test public void testToString() throws Exception { - Pair<String, String> pair = Pair.of("Key", "Value"); + final Pair<String, String> pair = Pair.of("Key", "Value"); assertEquals("(Key,Value)", pair.toString()); } @Test public void testToStringCustom() throws Exception { - Calendar date = Calendar.getInstance(); + final Calendar date = Calendar.getInstance(); date.set(2011, Calendar.APRIL, 25); - Pair<String, Calendar> pair = Pair.of("DOB", date); + final Pair<String, Calendar> pair = Pair.of("DOB", date); assertEquals("Test created on " + "04-25-2011", pair.toString("Test created on %2$tm-%2$td-%2$tY")); } @Test public void testFormattable_simple() throws Exception { - Pair<String, String> pair = Pair.of("Key", "Value"); + final Pair<String, String> pair = Pair.of("Key", "Value"); assertEquals("(Key,Value)", String.format("%1$s", pair)); } @Test public void testFormattable_padded() throws Exception { - Pair<String, String> pair = Pair.of("Key", "Value"); + final Pair<String, String> pair = Pair.of("Key", "Value"); assertEquals(" (Key,Value)", String.format("%1$20s", pair)); } Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff ============================================================================== --- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java (original) +++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/tuple/TripleTest.java Tue Jan 22 07:09:45 2013 @@ -34,12 +34,12 @@ public class TripleTest { @Test public void testTripleOf() throws Exception { - Triple<Integer, String, Boolean> triple = Triple.of(0, "foo", Boolean.TRUE); + final Triple<Integer, String, Boolean> triple = Triple.of(0, "foo", Boolean.TRUE); assertTrue(triple instanceof ImmutableTriple<?, ?, ?>); assertEquals(0, ((ImmutableTriple<Integer, String, Boolean>) triple).left.intValue()); assertEquals("foo", ((ImmutableTriple<Integer, String, Boolean>) triple).middle); assertEquals(Boolean.TRUE, ((ImmutableTriple<Integer, String, Boolean>) triple).right); - Triple<Object, String, Long> triple2 = Triple.of(null, "bar", Long.valueOf(200L)); + final Triple<Object, String, Long> triple2 = Triple.of(null, "bar", Long.valueOf(200L)); assertTrue(triple2 instanceof ImmutableTriple<?, ?, ?>); assertNull(((ImmutableTriple<Object, String, Long>) triple2).left); assertEquals("bar", ((ImmutableTriple<Object, String, Long>) triple2).middle); @@ -48,19 +48,19 @@ public class TripleTest { @Test public void testCompatibilityBetweenTriples() throws Exception { - Triple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.TRUE); - Triple<Integer, String, Boolean> triple2 = MutableTriple.of(0, "foo", Boolean.TRUE); + final Triple<Integer, String, Boolean> triple = ImmutableTriple.of(0, "foo", Boolean.TRUE); + final Triple<Integer, String, Boolean> triple2 = MutableTriple.of(0, "foo", Boolean.TRUE); assertEquals(triple, triple2); assertEquals(triple.hashCode(), triple2.hashCode()); - HashSet<Triple<Integer, String, Boolean>> set = new HashSet<Triple<Integer, String, Boolean>>(); + final HashSet<Triple<Integer, String, Boolean>> set = new HashSet<Triple<Integer, String, Boolean>>(); set.add(triple); assertTrue(set.contains(triple2)); } @Test public void testComparable1() throws Exception { - Triple<String, String, String> triple1 = Triple.of("A", "D", "A"); - Triple<String, String, String> triple2 = Triple.of("B", "C", "A"); + final Triple<String, String, String> triple1 = Triple.of("A", "D", "A"); + final Triple<String, String, String> triple2 = Triple.of("B", "C", "A"); assertTrue(triple1.compareTo(triple1) == 0); assertTrue(triple1.compareTo(triple2) < 0); assertTrue(triple2.compareTo(triple2) == 0); @@ -69,8 +69,8 @@ public class TripleTest { @Test public void testComparable2() throws Exception { - Triple<String, String, String> triple1 = Triple.of("A", "C", "B"); - Triple<String, String, String> triple2 = Triple.of("A", "D", "B"); + final Triple<String, String, String> triple1 = Triple.of("A", "C", "B"); + final Triple<String, String, String> triple2 = Triple.of("A", "D", "B"); assertTrue(triple1.compareTo(triple1) == 0); assertTrue(triple1.compareTo(triple2) < 0); assertTrue(triple2.compareTo(triple2) == 0); @@ -79,8 +79,8 @@ public class TripleTest { @Test public void testComparable3() throws Exception { - Triple<String, String, String> triple1 = Triple.of("A", "A", "D"); - Triple<String, String, String> triple2 = Triple.of("A", "B", "C"); + final Triple<String, String, String> triple1 = Triple.of("A", "A", "D"); + final Triple<String, String, String> triple2 = Triple.of("A", "B", "C"); assertTrue(triple1.compareTo(triple1) == 0); assertTrue(triple1.compareTo(triple2) < 0); assertTrue(triple2.compareTo(triple2) == 0); @@ -89,8 +89,8 @@ public class TripleTest { @Test public void testComparable4() throws Exception { - Triple<String, String, String> triple1 = Triple.of("B", "A", "C"); - Triple<String, String, String> triple2 = Triple.of("B", "A", "D"); + final Triple<String, String, String> triple1 = Triple.of("B", "A", "C"); + final Triple<String, String, String> triple2 = Triple.of("B", "A", "D"); assertTrue(triple1.compareTo(triple1) == 0); assertTrue(triple1.compareTo(triple2) < 0); assertTrue(triple2.compareTo(triple2) == 0); @@ -99,27 +99,27 @@ public class TripleTest { @Test public void testToString() throws Exception { - Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); + final Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); assertEquals("(Key,Something,Value)", triple.toString()); } @Test public void testToStringCustom() throws Exception { - Calendar date = Calendar.getInstance(); + final Calendar date = Calendar.getInstance(); date.set(2011, Calendar.APRIL, 25); - Triple<String, String, Calendar> triple = Triple.of("DOB", "string", date); + final Triple<String, String, Calendar> triple = Triple.of("DOB", "string", date); assertEquals("Test created on " + "04-25-2011", triple.toString("Test created on %3$tm-%3$td-%3$tY")); } @Test public void testFormattable_simple() throws Exception { - Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); + final Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); assertEquals("(Key,Something,Value)", String.format("%1$s", triple)); } @Test public void testFormattable_padded() throws Exception { - Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); + final Triple<String, String, String> triple = Triple.of("Key", "Something", "Value"); assertEquals(" (Key,Something,Value)", String.format("%1$30s", triple)); }