Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B689E2C8 for ; Mon, 7 Jan 2013 17:17:03 +0000 (UTC) Received: (qmail 57642 invoked by uid 500); 7 Jan 2013 17:17:02 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 57569 invoked by uid 500); 7 Jan 2013 17:17:02 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 57560 invoked by uid 99); 7 Jan 2013 17:17:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 17:17:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2013 17:16:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E40192388C2C; Mon, 7 Jan 2013 17:15:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1429905 [22/26] - in /commons/proper/collections/trunk/src: main/java/org/apache/commons/collections/ main/java/org/apache/commons/collections/bag/ main/java/org/apache/commons/collections/bidimap/ main/java/org/apache/commons/collections/... Date: Mon, 07 Jan 2013 17:15:24 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130107171546.E40192388C2C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/MultiKeyTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/MultiKeyTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/MultiKeyTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/MultiKeyTest.java Mon Jan 7 17:15:14 2013 @@ -42,7 +42,7 @@ public class MultiKeyTest extends TestCa Integer FOUR = new Integer(4); Integer FIVE = new Integer(5); - public MultiKeyTest(String name) { + public MultiKeyTest(final String name) { super(name); } @@ -103,19 +103,19 @@ public class MultiKeyTest extends TestCa } public void testConstructorsByArrayNull() throws Exception { - Integer[] keys = null; + final Integer[] keys = null; try { new MultiKey(keys); fail(); - } catch (IllegalArgumentException ex) {} + } catch (final IllegalArgumentException ex) {} try { new MultiKey(keys, true); fail(); - } catch (IllegalArgumentException ex) {} + } catch (final IllegalArgumentException ex) {} try { new MultiKey(keys, false); fail(); - } catch (IllegalArgumentException ex) {} + } catch (final IllegalArgumentException ex) {} } public void testSize() { @@ -135,31 +135,31 @@ public class MultiKeyTest extends TestCa } public void testGetIndexed() { - MultiKey mk = new MultiKey(ONE, TWO); + final MultiKey mk = new MultiKey(ONE, TWO); Assert.assertSame(ONE, mk.getKey(0)); Assert.assertSame(TWO, mk.getKey(1)); try { mk.getKey(-1); fail(); - } catch (IndexOutOfBoundsException ex) {} + } catch (final IndexOutOfBoundsException ex) {} try { mk.getKey(2); fail(); - } catch (IndexOutOfBoundsException ex) {} + } catch (final IndexOutOfBoundsException ex) {} } public void testGetKeysSimpleConstructor() { - MultiKey mk = new MultiKey(ONE, TWO); - Object[] array = mk.getKeys(); + final MultiKey mk = new MultiKey(ONE, TWO); + final Object[] array = mk.getKeys(); Assert.assertSame(ONE, array[0]); Assert.assertSame(TWO, array[1]); Assert.assertEquals(2, array.length); } public void testGetKeysArrayConstructorCloned() { - Integer[] keys = new Integer[] { ONE, TWO }; - MultiKey mk = new MultiKey(keys, true); - Object[] array = mk.getKeys(); + final Integer[] keys = new Integer[] { ONE, TWO }; + final MultiKey mk = new MultiKey(keys, true); + final Object[] array = mk.getKeys(); Assert.assertTrue(array != keys); Assert.assertTrue(Arrays.equals(array, keys)); Assert.assertSame(ONE, array[0]); @@ -168,9 +168,9 @@ public class MultiKeyTest extends TestCa } public void testGetKeysArrayConstructorNonCloned() { - Integer[] keys = new Integer[] { ONE, TWO }; - MultiKey mk = new MultiKey(keys, false); - Object[] array = mk.getKeys(); + final Integer[] keys = new Integer[] { ONE, TWO }; + final MultiKey mk = new MultiKey(keys, false); + final Object[] array = mk.getKeys(); Assert.assertTrue(array != keys); // still not equal Assert.assertTrue(Arrays.equals(array, keys)); Assert.assertSame(ONE, array[0]); @@ -179,22 +179,22 @@ public class MultiKeyTest extends TestCa } public void testHashCode() { - MultiKey mk1 = new MultiKey(ONE, TWO); - MultiKey mk2 = new MultiKey(ONE, TWO); - MultiKey mk3 = new MultiKey(ONE, "TWO"); + final MultiKey mk1 = new MultiKey(ONE, TWO); + final MultiKey mk2 = new MultiKey(ONE, TWO); + final MultiKey mk3 = new MultiKey(ONE, "TWO"); Assert.assertTrue(mk1.hashCode() == mk1.hashCode()); Assert.assertTrue(mk1.hashCode() == mk2.hashCode()); Assert.assertTrue(mk1.hashCode() != mk3.hashCode()); - int total = (0 ^ ONE.hashCode()) ^ TWO.hashCode(); + final int total = (0 ^ ONE.hashCode()) ^ TWO.hashCode(); Assert.assertEquals(total, mk1.hashCode()); } public void testEquals() { - MultiKey mk1 = new MultiKey(ONE, TWO); - MultiKey mk2 = new MultiKey(ONE, TWO); - MultiKey mk3 = new MultiKey(ONE, "TWO"); + final MultiKey mk1 = new MultiKey(ONE, TWO); + final MultiKey mk2 = new MultiKey(ONE, TWO); + final MultiKey mk3 = new MultiKey(ONE, "TWO"); Assert.assertEquals(mk1, mk1); Assert.assertEquals(mk1, mk2); @@ -209,13 +209,13 @@ public class MultiKeyTest extends TestCa private final String name; private int hashCode = 1; - public SystemHashCodeSimulatingKey(String name) + public SystemHashCodeSimulatingKey(final String name) { this.name = name; } @Override - public boolean equals(Object obj) + public boolean equals(final Object obj) { return obj instanceof SystemHashCodeSimulatingKey && name.equals(((SystemHashCodeSimulatingKey)obj).name); @@ -236,27 +236,27 @@ public class MultiKeyTest extends TestCa public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException { SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test"); - MultiKey mk = new MultiKey(ONE, sysKey); - Map map = new HashMap(); + final MultiKey mk = new MultiKey(ONE, sysKey); + final Map map = new HashMap(); map.put(mk, TWO); // serialize - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(baos); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(sysKey); out.writeObject(map); out.close(); // deserialize - ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); - ObjectInputStream in = new ObjectInputStream(bais); + final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + final ObjectInputStream in = new ObjectInputStream(bais); sysKey = (SystemHashCodeSimulatingKey)in.readObject(); // simulate deserialization in another process - Map map2 = (Map) in.readObject(); + final Map map2 = (Map) in.readObject(); in.close(); assertEquals(2, sysKey.hashCode()); // different hashCode now - MultiKey mk2 = new MultiKey(ONE, sysKey); + final MultiKey mk2 = new MultiKey(ONE, sysKey); assertEquals(TWO, map2.get(mk2)); } } Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/TiedMapEntryTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/TiedMapEntryTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/TiedMapEntryTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/TiedMapEntryTest.java Mon Jan 7 17:15:14 2013 @@ -27,7 +27,7 @@ import java.util.Map; */ public class TiedMapEntryTest extends AbstractMapEntryTest { - public TiedMapEntryTest(String testName) { + public TiedMapEntryTest(final String testName) { super(testName); } @@ -36,8 +36,8 @@ public class TiedMapEntryTest exte * Gets the instance to test */ @Override - public Map.Entry makeMapEntry(K key, V value) { - Map map = new HashMap(); + public Map.Entry makeMapEntry(final K key, final V value) { + final Map map = new HashMap(); map.put(key, value); return new TiedMapEntry(map, key); } @@ -56,7 +56,7 @@ public class TiedMapEntryTest exte */ @SuppressWarnings("unchecked") public void testSetValue() { - Map map = new HashMap(); + final Map map = new HashMap(); map.put((K) "A", (V) "a"); map.put((K) "B", (V) "b"); map.put((K) "C", (V) "c"); Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntryTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntryTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntryTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/keyvalue/UnmodifiableMapEntryTest.java Mon Jan 7 17:15:14 2013 @@ -29,7 +29,7 @@ import org.apache.commons.collections.Un */ public class UnmodifiableMapEntryTest extends AbstractMapEntryTest { - public UnmodifiableMapEntryTest(String testName) { + public UnmodifiableMapEntryTest(final String testName) { super(testName); } @@ -50,7 +50,7 @@ public class UnmodifiableMapEntryTest makeMapEntry(K key, V value) { + public Map.Entry makeMapEntry(final K key, final V value) { return new UnmodifiableMapEntry(key, value); } @@ -68,13 +68,13 @@ public class UnmodifiableMapEntryTest pair = new DefaultKeyValue((K) key, (V) value); + final KeyValue pair = new DefaultKeyValue((K) key, (V) value); entry = new UnmodifiableMapEntry(pair); assertSame(key, entry.getKey()); assertSame(value, entry.getValue()); // 3. test copy constructor - Map.Entry entry2 = new UnmodifiableMapEntry(entry); + final Map.Entry entry2 = new UnmodifiableMapEntry(entry); assertSame(key, entry2.getKey()); assertSame(value, entry2.getValue()); @@ -101,11 +101,11 @@ public class UnmodifiableMapEntryTest entry = makeMapEntry(); + final Map.Entry entry = makeMapEntry(); try { entry.setValue(null); fail(); - } catch (UnsupportedOperationException ex) {} + } catch (final UnsupportedOperationException ex) {} } } Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractLinkedListTest.java Mon Jan 7 17:15:14 2013 @@ -29,7 +29,7 @@ import java.util.Arrays; */ public abstract class AbstractLinkedListTest extends AbstractListTest { - public AbstractLinkedListTest(String testName) { + public AbstractLinkedListTest(final String testName) { super(testName); } @@ -37,11 +37,11 @@ public abstract class AbstractLinkedList @SuppressWarnings("unchecked") public void testRemoveFirst() { resetEmpty(); - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); if (isRemoveSupported() == false) { try { list.removeFirst(); - } catch (UnsupportedOperationException ex) {} + } catch (final UnsupportedOperationException ex) {} } list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" })); @@ -61,11 +61,11 @@ public abstract class AbstractLinkedList @SuppressWarnings("unchecked") public void testRemoveLast() { resetEmpty(); - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); if (isRemoveSupported() == false) { try { list.removeLast(); - } catch (UnsupportedOperationException ex) {} + } catch (final UnsupportedOperationException ex) {} } list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" })); @@ -82,11 +82,11 @@ public abstract class AbstractLinkedList @SuppressWarnings("unchecked") public void testAddNodeAfter() { resetEmpty(); - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); if (isAddSupported() == false) { try { list.addFirst(null); - } catch (UnsupportedOperationException ex) {} + } catch (final UnsupportedOperationException ex) {} } list.addFirst((E) "value1"); @@ -118,7 +118,7 @@ public abstract class AbstractLinkedList if (isAddSupported() == false || isRemoveSupported() == false) { return; } - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); list.addAll(Arrays.asList((E[]) new String[] { "value1", "value2" })); list.removeNode(list.getNode(0, false)); @@ -141,13 +141,13 @@ public abstract class AbstractLinkedList @SuppressWarnings("unchecked") public void testGetNode() { resetEmpty(); - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); // get marker assertEquals(list.getNode(0, true).previous, list.getNode(0, true).next); try { list.getNode(0, false); fail("Expecting IndexOutOfBoundsException."); - } catch (IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ex) { // expected } list.addAll( Arrays.asList((E[]) new String[]{"value1", "value2"})); @@ -159,25 +159,25 @@ public abstract class AbstractLinkedList try { list.getNode(2, false); fail("Expecting IndexOutOfBoundsException."); - } catch (IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ex) { // expected } try { list.getNode(-1, false); fail("Expecting IndexOutOfBoundsException."); - } catch (IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ex) { // expected } try { list.getNode(3, true); fail("Expecting IndexOutOfBoundsException."); - } catch (IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ex) { // expected } } protected void checkNodes() { - AbstractLinkedList list = getCollection(); + final AbstractLinkedList list = getCollection(); for (int i = 0; i < list.size; i++) { assertEquals(list.getNode(i, false).next, list.getNode(i + 1, true)); if (i < list.size - 1) { Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/AbstractListTest.java Mon Jan 7 17:15:14 2013 @@ -60,7 +60,7 @@ public abstract class AbstractListTest list1 = getCollection(); - List list2 = getConfirmed(); + final List list1 = getCollection(); + final List list2 = getConfirmed(); assertEquals("List should equal confirmed", list1, list2); assertEquals("Confirmed should equal list", list2, list1); @@ -95,12 +95,12 @@ public abstract class AbstractListTest iterator1 = list1.iterator(); - Iterator iterator2 = list2.iterator(); - E[] array = (E[]) list1.toArray(); + final Iterator iterator1 = list1.iterator(); + final Iterator iterator2 = list2.iterator(); + final E[] array = (E[]) list1.toArray(); while (iterator2.hasNext()) { assertTrue("List iterator should have next", iterator1.hasNext()); - Object o1 = iterator1.next(); + final Object o1 = iterator1.next(); Object o2 = iterator2.next(); assertEquals("Iterator elements should be equal", o1, o2); o2 = list1.get(i); @@ -125,7 +125,7 @@ public abstract class AbstractListTest makeConfirmedCollection() { - ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList(); return list; } @@ -134,7 +134,7 @@ public abstract class AbstractListTest makeConfirmedFullCollection() { - ArrayList list = new ArrayList(); + final ArrayList list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); return list; } @@ -153,7 +153,7 @@ public abstract class AbstractListTest makeFullCollection() { // only works if list supports optional "addAll(Collection)" - List list = makeObject(); + final List list = makeObject(); list.addAll(Arrays.asList(getFullElements())); return list; } @@ -190,13 +190,13 @@ public abstract class AbstractListTest list; - E element = getOtherElements()[0]; + final E element = getOtherElements()[0]; try { list = makeObject(); list.add(Integer.MIN_VALUE, element); fail("List.add should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } @@ -204,7 +204,7 @@ public abstract class AbstractListTest list; - E element = getOtherElements()[0]; + final E element = getOtherElements()[0]; try { list = makeFullCollection(); list.add(Integer.MIN_VALUE, element); fail("List.add should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } @@ -249,7 +249,7 @@ public abstract class AbstractListTest listForC = Arrays.asList(getFullElements()); - Collection c = new AbstractCollection() { + final Collection c = new AbstractCollection() { @Override public int size() { return listForC.size(); @@ -383,8 +383,8 @@ public abstract class AbstractListTest list = getCollection(); - E[] elements = getFullElements(); + final List list = getCollection(); + final E[] elements = getFullElements(); for (int i = 0; i < elements.length; i++) { assertEquals("List should contain correct elements", elements[i], list.get(i)); verify(); @@ -396,40 +396,40 @@ public abstract class AbstractListTest list = makeObject(); + final List list = makeObject(); try { list.get(Integer.MIN_VALUE); fail("List.get should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(-1); fail("List.get should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(0); fail("List.get should throw IndexOutOfBoundsException [0]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(1); fail("List.get should throw IndexOutOfBoundsException [1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(Integer.MAX_VALUE); fail("List.get should throw IndexOutOfBoundsException [Integer.MAX_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -439,33 +439,33 @@ public abstract class AbstractListTest list = makeFullCollection(); + final List list = makeFullCollection(); try { list.get(Integer.MIN_VALUE); fail("List.get should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(-1); fail("List.get should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(getFullElements().length); fail("List.get should throw IndexOutOfBoundsException [size]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.get(Integer.MAX_VALUE); fail("List.get should throw IndexOutOfBoundsException [Integer.MAX_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -475,19 +475,19 @@ public abstract class AbstractListTest list1 = getCollection(); - List list2 = getConfirmed(); + final List list1 = getCollection(); + final List list2 = getConfirmed(); - Iterator iterator = list2.iterator(); + final Iterator iterator = list2.iterator(); while (iterator.hasNext()) { - Object element = iterator.next(); + final Object element = iterator.next(); assertEquals("indexOf should return correct result", list1.indexOf(element), list2.indexOf(element)); verify(); } - E[] other = getOtherElements(); - for (E element : other) { + final E[] other = getOtherElements(); + for (final E element : other) { assertEquals("indexOf should return -1 for nonexistent element", -1, list1.indexOf(element)); verify(); @@ -499,19 +499,19 @@ public abstract class AbstractListTest list1 = getCollection(); - List list2 = getConfirmed(); + final List list1 = getCollection(); + final List list2 = getConfirmed(); - Iterator iterator = list2.iterator(); + final Iterator iterator = list2.iterator(); while (iterator.hasNext()) { - E element = iterator.next(); + final E element = iterator.next(); assertEquals("lastIndexOf should return correct result", list1.lastIndexOf(element), list2.lastIndexOf(element)); verify(); } - E[] other = getOtherElements(); - for (E element : other) { + final E[] other = getOtherElements(); + for (final E element : other) { assertEquals("lastIndexOf should return -1 for nonexistent " + "element", -1, list1.lastIndexOf(element)); verify(); @@ -527,41 +527,41 @@ public abstract class AbstractListTest list = makeObject(); - E element = getOtherElements()[0]; + final List list = makeObject(); + final E element = getOtherElements()[0]; try { list.set(Integer.MIN_VALUE, element); fail("List.set should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.set(-1, element); fail("List.set should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.set(0, element); fail("List.set should throw IndexOutOfBoundsException [0]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.set(1, element); fail("List.set should throw IndexOutOfBoundsException [1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } try { list.set(Integer.MAX_VALUE, element); fail("List.set should throw IndexOutOfBoundsException [Integer.MAX_VALUE]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -576,28 +576,28 @@ public abstract class AbstractListTest list = makeFullCollection(); - E element = getOtherElements()[0]; + final List list = makeFullCollection(); + final E element = getOtherElements()[0]; try { list.set(Integer.MIN_VALUE, element); fail("List.set should throw IndexOutOfBoundsException " + "[Integer.MIN_VALUE]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.set(-1, element); fail("List.set should throw IndexOutOfBoundsException [-1]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.set(getFullElements().length, element); fail("List.set should throw IndexOutOfBoundsException [size]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } @@ -605,7 +605,7 @@ public abstract class AbstractListTest list = makeObject(); + final List list = makeObject(); try { list.remove(Integer.MIN_VALUE); fail("List.remove should throw IndexOutOfBoundsException [Integer.MIN_VALUE]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(-1); fail("List.remove should throw IndexOutOfBoundsException [-1]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(0); fail("List.remove should throw IndexOutOfBoundsException [0]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(1); fail("List.remove should throw IndexOutOfBoundsException [1]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(Integer.MAX_VALUE); fail("List.remove should throw IndexOutOfBoundsException [Integer.MAX_VALUE]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } } @@ -709,27 +709,27 @@ public abstract class AbstractListTest list = makeFullCollection(); + final List list = makeFullCollection(); try { list.remove(Integer.MIN_VALUE); fail("List.remove should throw IndexOutOfBoundsException " + "[Integer.MIN_VALUE]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(-1); fail("List.remove should throw IndexOutOfBoundsException [-1]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.remove(getFullElements().length); fail("List.remove should throw IndexOutOfBoundsException [size]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } @@ -737,7 +737,7 @@ public abstract class AbstractListTest it = getCollection().listIterator(); - E zero = it.next(); - E one = it.next(); - E two = it.next(); - E two2 = it.previous(); - E one2 = it.previous(); + final ListIterator it = getCollection().listIterator(); + final E zero = it.next(); + final E one = it.next(); + final E two = it.next(); + final E two2 = it.previous(); + final E one2 = it.previous(); assertEquals(one, one2); assertEquals(two, two2); assertEquals(zero, getCollection().get(0)); @@ -820,7 +820,7 @@ public abstract class AbstractListTest 2, it.hasNext()); assertEquals(true, it.hasPrevious()); @@ -837,12 +837,12 @@ public abstract class AbstractListTest it = getCollection().listIterator(); - E zero = it.next(); - E one = it.next(); - E two = it.next(); - E two2 = it.previous(); - E one2 = it.previous(); + final ListIterator it = getCollection().listIterator(); + final E zero = it.next(); + final E one = it.next(); + final E two = it.next(); + final E two2 = it.previous(); + final E one2 = it.previous(); assertEquals(one, one2); assertEquals(two, two2); assertEquals(zero, getCollection().get(0)); @@ -852,7 +852,7 @@ public abstract class AbstractListTest 2, it.hasNext()); @@ -869,19 +869,19 @@ public abstract class AbstractListTest it = getCollection().listIterator(); - E zero = it.next(); - E one = it.next(); - E two = it.next(); + final ListIterator it = getCollection().listIterator(); + final E zero = it.next(); + final E one = it.next(); + final E two = it.next(); assertEquals(zero, getCollection().get(0)); assertEquals(one, getCollection().get(1)); assertEquals(two, getCollection().get(2)); - E three = getCollection().get(3); + final E three = getCollection().get(3); it.remove(); // removed element at index 2 (two) assertEquals(zero, getCollection().get(0)); assertEquals(one, getCollection().get(1)); - E three2 = it.next(); // do next after remove + final E three2 = it.next(); // do next after remove assertEquals(three, three2); assertEquals(getCollection().size() > 3, it.hasNext()); assertEquals(true, it.hasPrevious()); @@ -898,10 +898,10 @@ public abstract class AbstractListTest it = getCollection().listIterator(); - E zero = it.next(); - E one = it.next(); - E two = it.next(); + final ListIterator it = getCollection().listIterator(); + final E zero = it.next(); + final E one = it.next(); + final E two = it.next(); assertEquals(zero, getCollection().get(0)); assertEquals(one, getCollection().get(1)); assertEquals(two, getCollection().get(2)); @@ -909,7 +909,7 @@ public abstract class AbstractListTest iter, int i) { - List list = getCollection(); - int max = getFullElements().length; + private void forwardTest(final ListIterator iter, int i) { + final List list = getCollection(); + final int max = getFullElements().length; while (i < max) { assertTrue("Iterator should have next", iter.hasNext()); @@ -932,7 +932,7 @@ public abstract class AbstractListTest iter, int i) { - List list = getCollection(); + private void backwardTest(final ListIterator iter, int i) { + final List list = getCollection(); while (i > 0) { assertTrue("Iterator should have previous, i:" + i, @@ -965,22 +965,22 @@ public abstract class AbstractListTest list1 = getCollection(); - List list2 = getConfirmed(); + final List list1 = getCollection(); + final List list2 = getConfirmed(); - E[] elements = getFullElements(); + final E[] elements = getFullElements(); ListIterator iter1 = list1.listIterator(); ListIterator iter2 = list2.listIterator(); - for (E element : elements) { + for (final E element : elements) { iter1.add(element); iter2.add(element); verify(); @@ -1013,7 +1013,7 @@ public abstract class AbstractListTest iter1 = getCollection().listIterator(); - ListIterator iter2 = getConfirmed().listIterator(); - for (E element : elements) { + final ListIterator iter1 = getCollection().listIterator(); + final ListIterator iter2 = getConfirmed().listIterator(); + for (final E element : elements) { iter1.next(); iter2.next(); iter1.set(element); @@ -1047,13 +1047,13 @@ public abstract class AbstractListTest list = makeObject(); + final List list = makeObject(); if (!(list instanceof Serializable && isTestSerialization())) { return; } - byte[] objekt = writeExternalFormToBytes((Serializable) list); - List list2 = (List) readExternalFormFromBytes(objekt); + final byte[] objekt = writeExternalFormToBytes((Serializable) list); + final List list2 = (List) readExternalFormFromBytes(objekt); assertEquals("Both lists are empty", 0, list.size()); assertEquals("Both lists are empty", 0, list2.size()); @@ -1061,14 +1061,14 @@ public abstract class AbstractListTest list = makeFullCollection(); - int size = getFullElements().length; + final List list = makeFullCollection(); + final int size = getFullElements().length; if (!(list instanceof Serializable && isTestSerialization())) { return; } - byte[] objekt = writeExternalFormToBytes((Serializable) list); - List list2 = (List) readExternalFormFromBytes(objekt); + final byte[] objekt = writeExternalFormToBytes((Serializable) list); + final List list2 = (List) readExternalFormFromBytes(objekt); assertEquals("Both lists are same size", size, list.size()); assertEquals("Both lists are same size", size, list2.size()); @@ -1101,10 +1101,10 @@ public abstract class AbstractListTest list = makeObject(); + final List list = makeObject(); if (list instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) { - List list2 = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list)); + final List list2 = (List) readExternalFormFromDisk(getCanonicalEmptyCollectionName(list)); assertEquals("List is empty", 0, list2.size()); assertEquals(list, list2); } @@ -1125,9 +1125,9 @@ public abstract class AbstractListTest list = makeFullCollection(); + final List list = makeFullCollection(); if(list instanceof Serializable && !skipSerializedCanonicalTests() && isTestSerialization()) { - List list2 = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(list)); + final List list2 = (List) readExternalFormFromDisk(getCanonicalFullCollectionName(list)); if (list2.size() == 4) { // old serialized tests return; @@ -1157,9 +1157,9 @@ public abstract class AbstractListTest extends AbstractListTest { - private AbstractListTest outer; + private final AbstractListTest outer; - public BulkTestSubList(AbstractListTest outer) { + public BulkTestSubList(final AbstractListTest outer) { super(""); this.outer = outer; } @@ -1167,7 +1167,7 @@ public abstract class AbstractListTest l = Arrays.asList(outer.getFullElements()); + final List l = Arrays.asList(outer.getFullElements()); return (E[]) l.subList(3, l.size() - 3).toArray(); } @@ -1198,7 +1198,7 @@ public abstract class AbstractListTest makeFullCollection() { - int size = getFullElements().length; + final int size = getFullElements().length; return outer.makeFullCollection().subList(3, size - 3); } @@ -1212,7 +1212,7 @@ public abstract class AbstractListTest sub = getCollection().subList(1, size); getCollection().add(getOtherElements()[0]); failFastAll(sub); @@ -1276,7 +1276,7 @@ public abstract class AbstractListTest sub = getCollection().subList(1, size); getCollection().remove(0); failFastAll(sub); @@ -1306,9 +1306,9 @@ public abstract class AbstractListTest list) { - Method[] methods = List.class.getMethods(); - for (Method method : methods) { + protected void failFastAll(final List list) { + final Method[] methods = List.class.getMethods(); + for (final Method method : methods) { failFastMethod(list, method); } } @@ -1325,16 +1325,16 @@ public abstract class AbstractListTest list, Method m) { + protected void failFastMethod(final List list, final Method m) { if (m.getName().equals("equals")) { return; } - E element = getOtherElements()[0]; - Collection c = Collections.singleton(element); + final E element = getOtherElements()[0]; + final Collection c = Collections.singleton(element); - Class[] types = m.getParameterTypes(); - Object[] params = new Object[types.length]; + final Class[] types = m.getParameterTypes(); + final Object[] params = new Object[types.length]; for (int i = 0; i < params.length; i++) { if (types[i] == Integer.TYPE) { params[i] = new Integer(0); @@ -1350,10 +1350,10 @@ public abstract class AbstractListTest extends AbstractLinkedListTest { - public CursorableLinkedListTest(String testName) { + public CursorableLinkedListTest(final String testName) { super(testName); } @@ -77,7 +77,7 @@ public class CursorableLinkedListTest list.add(7,(E) new Integer(5)); assertEquals("[-2, -1, 0, 1, 2, 3, 4, 5]",list.toString()); - java.util.List list2 = new java.util.LinkedList(); + final java.util.List list2 = new java.util.LinkedList(); list2.add((E) "A"); list2.add((E) "B"); list2.add((E) "C"); @@ -142,7 +142,7 @@ public class CursorableLinkedListTest @SuppressWarnings("unchecked") public void testContainsAll() { assertTrue(list.containsAll(list)); - java.util.List list2 = new java.util.LinkedList(); + final java.util.List list2 = new java.util.LinkedList(); assertTrue(list.containsAll(list2)); list2.add((E) "A"); assertTrue(!list.containsAll(list2)); @@ -167,7 +167,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "4"); list.add((E) "5"); - CursorableLinkedList.Cursor it = list.cursor(); + final CursorableLinkedList.Cursor it = list.cursor(); assertTrue(it.hasNext()); assertTrue(!it.hasPrevious()); assertEquals("1", it.next()); @@ -223,7 +223,7 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - CursorableLinkedList.Cursor it = list.cursor(); + final CursorableLinkedList.Cursor it = list.cursor(); assertEquals("1", it.next()); it.set((E) "a"); assertEquals("a", it.previous()); @@ -248,11 +248,11 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - CursorableLinkedList.Cursor it = list.cursor(); + final CursorableLinkedList.Cursor it = list.cursor(); try { it.remove(); fail(); - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { // expected } assertEquals("1", it.next()); @@ -271,7 +271,7 @@ public class CursorableLinkedListTest assertEquals("[4, 5]", list.toString()); try { it.remove(); - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { // expected } assertEquals("4", it.next()); @@ -286,7 +286,7 @@ public class CursorableLinkedListTest @SuppressWarnings("unchecked") public void testCursorAdd() { - CursorableLinkedList.Cursor it = list.cursor(); + final CursorableLinkedList.Cursor it = list.cursor(); it.add((E) "1"); assertEquals("[1]", list.toString()); it.add((E) "3"); @@ -314,9 +314,9 @@ public class CursorableLinkedListTest list.add((E) "7"); list.add((E) "9"); - CursorableLinkedList.Cursor c1 = list.cursor(); - CursorableLinkedList.Cursor c2 = list.cursor(); - Iterator li = list.iterator(); + final CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c2 = list.cursor(); + final Iterator li = list.iterator(); // test cursors remain valid when list modified by std Iterator // test cursors skip elements removed via ListIterator @@ -358,13 +358,13 @@ public class CursorableLinkedListTest try { c2.next(); fail(); - } catch (NoSuchElementException nse) { + } catch (final NoSuchElementException nse) { } try { li.next(); fail(); - } catch (ConcurrentModificationException cme) { + } catch (final ConcurrentModificationException cme) { } c1.close(); // not necessary @@ -378,8 +378,8 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "5"); - CursorableLinkedList.Cursor c1 = list.cursor(); - Iterator li = list.iterator(); + final CursorableLinkedList.Cursor c1 = list.cursor(); + final Iterator li = list.iterator(); // test cursors remain valid when list modified by std Iterator // test cursors skip elements removed via ListIterator @@ -399,7 +399,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "5"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals(0, c1.nextIndex()); list.remove(0); @@ -416,7 +416,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "5"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals(0, c1.nextIndex()); assertEquals("1", c1.next()); @@ -432,7 +432,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "5"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals(0, c1.nextIndex()); list.add(0, (E) "0"); @@ -449,7 +449,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "5"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals(0, c1.nextIndex()); list.add(1, (E) "0"); @@ -466,7 +466,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("B", c1.previous()); @@ -485,7 +485,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -494,7 +494,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", list.remove(1)); @@ -511,7 +511,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -520,7 +520,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -538,7 +538,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -548,7 +548,7 @@ public class CursorableLinkedListTest list.add((E) "C"); list.add((E) "D"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("C", c1.next()); @@ -566,7 +566,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -576,7 +576,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("B", c1.previous()); @@ -593,7 +593,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -602,7 +602,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -618,7 +618,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -628,7 +628,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("B", c1.previous()); @@ -646,7 +646,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -655,7 +655,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); list.add(1, (E) "Z"); @@ -671,7 +671,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -680,7 +680,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -696,7 +696,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -706,7 +706,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("B", c1.previous()); @@ -722,7 +722,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -731,7 +731,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -747,7 +747,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -757,7 +757,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -772,7 +772,7 @@ public class CursorableLinkedListTest try { c1.set((E) "Z"); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -782,7 +782,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); assertEquals("B", c1.previous()); @@ -800,7 +800,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } @SuppressWarnings("unchecked") @@ -809,7 +809,7 @@ public class CursorableLinkedListTest list.add((E) "B"); list.add((E) "C"); - CursorableLinkedList.Cursor c1 = list.cursor(); + final CursorableLinkedList.Cursor c1 = list.cursor(); assertEquals("A", c1.next()); assertEquals("B", c1.next()); @@ -826,7 +826,7 @@ public class CursorableLinkedListTest try { c1.remove(); fail(); - } catch (IllegalStateException ex) {} + } catch (final IllegalStateException ex) {} } //----------------------------------------------------------------------- @@ -838,11 +838,11 @@ public class CursorableLinkedListTest assertTrue(list.equals(list)); assertEquals(list.hashCode(),list.hashCode()); - CursorableLinkedList list2 = new CursorableLinkedList(); + final CursorableLinkedList list2 = new CursorableLinkedList(); assertTrue(!list.equals(list2)); assertTrue(!list2.equals(list)); - java.util.List list3 = new java.util.LinkedList(); + final java.util.List list3 = new java.util.LinkedList(); assertTrue(!list.equals(list3)); assertTrue(!list3.equals(list)); assertTrue(list2.equals(list3)); @@ -899,7 +899,7 @@ public class CursorableLinkedListTest try { list.get(0); fail("shouldn't get here"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } @@ -912,14 +912,14 @@ public class CursorableLinkedListTest try { list.get(-1); fail("shouldn't get here"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } try { list.get(2); fail("shouldn't get here"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } } @@ -1009,7 +1009,7 @@ public class CursorableLinkedListTest list.add((E) "3"); list.add((E) "4"); list.add((E) "5"); - ListIterator it = list.listIterator(); + final ListIterator it = list.listIterator(); assertTrue(it.hasNext()); assertTrue(!it.hasPrevious()); assertEquals(-1, it.previousIndex()); @@ -1095,7 +1095,7 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - ListIterator it = list.listIterator(); + final ListIterator it = list.listIterator(); assertEquals("1", it.next()); it.set((E) "a"); assertEquals("a", it.previous()); @@ -1119,10 +1119,10 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - ListIterator it = list.listIterator(); + final ListIterator it = list.listIterator(); try { it.remove(); - } catch(IllegalStateException e) { + } catch(final IllegalStateException e) { // expected } assertEquals("1",it.next()); @@ -1141,7 +1141,7 @@ public class CursorableLinkedListTest assertEquals("[4, 5]",list.toString()); try { it.remove(); - } catch(IllegalStateException e) { + } catch(final IllegalStateException e) { // expected } assertEquals("4",it.next()); @@ -1156,7 +1156,7 @@ public class CursorableLinkedListTest @Override @SuppressWarnings("unchecked") public void testListIteratorAdd() { - ListIterator it = list.listIterator(); + final ListIterator it = list.listIterator(); it.add((E) "1"); assertEquals("[1]", list.toString()); it.add((E) "3"); @@ -1180,7 +1180,7 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - HashSet set = new HashSet(); + final HashSet set = new HashSet(); set.add((E) "A"); set.add((E) "2"); set.add((E) "C"); @@ -1262,7 +1262,7 @@ public class CursorableLinkedListTest list.add((E) "5"); list.add((E) "5"); - HashSet set = new HashSet(); + final HashSet set = new HashSet(); set.add((E) "A"); set.add((E) "2"); set.add((E) "C"); @@ -1319,7 +1319,7 @@ public class CursorableLinkedListTest list.add((E) "D"); list.add((E) "E"); - List sublist = list.subList(5, 5); + final List sublist = list.subList(5, 5); sublist.add((E) "F"); assertEquals("[A, B, C, D, E, F]", list.toString()); assertEquals("[F]", sublist.toString()); @@ -1336,7 +1336,7 @@ public class CursorableLinkedListTest list.add((E) "D"); list.add((E) "E"); - List sublist = list.subList(0, 0); + final List sublist = list.subList(0, 0); sublist.add((E) "a"); assertEquals("[a, A, B, C, D, E]", list.toString()); assertEquals("[a]", sublist.toString()); @@ -1353,7 +1353,7 @@ public class CursorableLinkedListTest list.add((E) "D"); list.add((E) "E"); - List sublist = list.subList(1, 3); + final List sublist = list.subList(1, 3); sublist.add((E) "a"); assertEquals("[A, B, C, a, D, E]", list.toString()); assertEquals("[B, C, a]", sublist.toString()); @@ -1370,7 +1370,7 @@ public class CursorableLinkedListTest list.add((E) "D"); list.add((E) "E"); - List sublist = list.subList(1, 4); + final List sublist = list.subList(1, 4); assertEquals("[B, C, D]", sublist.toString()); assertEquals("[A, B, C, D, E]", list.toString()); sublist.remove("C"); @@ -1392,7 +1392,7 @@ public class CursorableLinkedListTest list.add((E) "4"); list.add((E) "5"); - Object[] elts = list.toArray(); + final Object[] elts = list.toArray(); assertEquals("1", elts[0]); assertEquals("2", elts[1]); assertEquals("3", elts[2]); @@ -1400,7 +1400,7 @@ public class CursorableLinkedListTest assertEquals("5", elts[4]); assertEquals(5, elts.length); - String[] elts2 = list.toArray(new String[0]); + final String[] elts2 = list.toArray(new String[0]); assertEquals("1", elts2[0]); assertEquals("2", elts2[1]); assertEquals("3", elts2[2]); @@ -1408,7 +1408,7 @@ public class CursorableLinkedListTest assertEquals("5", elts2[4]); assertEquals(5, elts2.length); - String[] elts3 = new String[5]; + final String[] elts3 = new String[5]; assertSame(elts3, list.toArray(elts3)); assertEquals("1", elts3[0]); assertEquals("2", elts3[1]); @@ -1417,8 +1417,8 @@ public class CursorableLinkedListTest assertEquals("5", elts3[4]); assertEquals(5, elts3.length); - String[] elts4 = new String[3]; - String[] elts4b = list.toArray(elts4); + final String[] elts4 = new String[3]; + final String[] elts4b = list.toArray(elts4); assertTrue(elts4 != elts4b); assertEquals("1", elts4b[0]); assertEquals("2", elts4b[1]); @@ -1436,15 +1436,15 @@ public class CursorableLinkedListTest list.add((E) "D"); list.add((E) "E"); - java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); - java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); + final java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); + final java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); out.writeObject(list); out.flush(); out.close(); - java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); - java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); - Object list2 = in.readObject(); + final java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); + final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); + final Object list2 = in.readObject(); assertTrue(list != list2); assertTrue(list2.equals(list)); @@ -1458,15 +1458,15 @@ public class CursorableLinkedListTest list.add((E) "C"); list.add((E) "D"); list.add((E) "E"); - java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); - java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); + final java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); + final java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); out.writeObject(list); out.flush(); out.close(); - java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); - java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); - Object list2 = in.readObject(); + final java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); + final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); + final Object list2 = in.readObject(); assertTrue(list != list2); assertTrue(list2.equals(list)); @@ -1481,15 +1481,15 @@ public class CursorableLinkedListTest list.add((E) new Integer(i)); } - java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); - java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); + final java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); + final java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(buf); out.writeObject(list); out.flush(); out.close(); - java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); - java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); - Object list2 = in.readObject(); + final java.io.ByteArrayInputStream bufin = new java.io.ByteArrayInputStream(buf.toByteArray()); + final java.io.ObjectInputStream in = new java.io.ObjectInputStream(bufin); + final Object list2 = in.readObject(); assertTrue(list != list2); assertTrue(list2.equals(list)); @@ -1503,10 +1503,10 @@ public class CursorableLinkedListTest */ @Override public String[] ignoredTests() { - ArrayList list = new ArrayList(); - String prefix = "CursorableLinkedListTest"; - String bulk = ".bulkTestSubList"; - String[] ignored = new String[] { + final ArrayList list = new ArrayList(); + final String prefix = "CursorableLinkedListTest"; + final String bulk = ".bulkTestSubList"; + final String[] ignored = new String[] { ".testEmptyListSerialization", ".testFullListSerialization", ".testEmptyListCompatibility", @@ -1516,7 +1516,7 @@ public class CursorableLinkedListTest ".testCanonicalFullCollectionExists", ".testSerializeDeserializeThenCompare" }; - for (String element : ignored) { + for (final String element : ignored) { list.add(prefix + bulk + element); list.add(prefix + bulk + bulk + element); } Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/FixedSizeListTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/FixedSizeListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/FixedSizeListTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/FixedSizeListTest.java Mon Jan 7 17:15:14 2013 @@ -31,7 +31,7 @@ import java.util.List; */ public class FixedSizeListTest extends AbstractListTest { - public FixedSizeListTest(String testName) { + public FixedSizeListTest(final String testName) { super(testName); } @@ -42,7 +42,7 @@ public class FixedSizeListTest extend @Override public List makeFullCollection() { - List list = new ArrayList(); + final List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); return FixedSizeList.fixedSizeList(list); } Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/GrowthListTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/GrowthListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/GrowthListTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/GrowthListTest.java Mon Jan 7 17:15:14 2013 @@ -31,7 +31,7 @@ import java.util.List; */ public class GrowthListTest extends AbstractListTest { - public GrowthListTest(String testName) { + public GrowthListTest(final String testName) { super(testName); } @@ -42,15 +42,15 @@ public class GrowthListTest extends A @Override public List makeFullCollection() { - List list = new ArrayList(); + final List list = new ArrayList(); list.addAll(Arrays.asList(getFullElements())); return GrowthList.growthList(list); } //----------------------------------------------------------------------- public void testGrowthAdd() { - Integer one = new Integer(1); - GrowthList grower = new GrowthList(); + final Integer one = new Integer(1); + final GrowthList grower = new GrowthList(); assertEquals(0, grower.size()); grower.add(1, one); assertEquals(2, grower.size()); @@ -59,12 +59,12 @@ public class GrowthListTest extends A } public void testGrowthAddAll() { - Integer one = new Integer(1); - Integer two = new Integer(2); - Collection coll = new ArrayList(); + final Integer one = new Integer(1); + final Integer two = new Integer(2); + final Collection coll = new ArrayList(); coll.add(one); coll.add(two); - GrowthList grower = new GrowthList(); + final GrowthList grower = new GrowthList(); assertEquals(0, grower.size()); grower.addAll(1, coll); assertEquals(3, grower.size()); @@ -74,8 +74,8 @@ public class GrowthListTest extends A } public void testGrowthSet1() { - Integer one = new Integer(1); - GrowthList grower = new GrowthList(); + final Integer one = new Integer(1); + final GrowthList grower = new GrowthList(); assertEquals(0, grower.size()); grower.set(1, one); assertEquals(2, grower.size()); @@ -84,8 +84,8 @@ public class GrowthListTest extends A } public void testGrowthSet2() { - Integer one = new Integer(1); - GrowthList grower = new GrowthList(); + final Integer one = new Integer(1); + final GrowthList grower = new GrowthList(); assertEquals(0, grower.size()); grower.set(0, one); assertEquals(1, grower.size()); @@ -99,12 +99,12 @@ public class GrowthListTest extends A @Override public void testListAddByIndexBoundsChecking() { List list; - E element = getOtherElements()[0]; + final E element = getOtherElements()[0]; try { list = makeObject(); list.add(-1, element); fail("List.add should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -115,12 +115,12 @@ public class GrowthListTest extends A @Override public void testListAddByIndexBoundsChecking2() { List list; - E element = getOtherElements()[0]; + final E element = getOtherElements()[0]; try { list = makeFullCollection(); list.add(-1, element); fail("List.add should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -130,12 +130,12 @@ public class GrowthListTest extends A */ @Override public void testListSetByIndexBoundsChecking() { - List list = makeObject(); - E element = getOtherElements()[0]; + final List list = makeObject(); + final E element = getOtherElements()[0]; try { list.set(-1, element); fail("List.set should throw IndexOutOfBoundsException [-1]"); - } catch (IndexOutOfBoundsException e) { + } catch (final IndexOutOfBoundsException e) { // expected } } @@ -145,12 +145,12 @@ public class GrowthListTest extends A */ @Override public void testListSetByIndexBoundsChecking2() { - List list = makeFullCollection(); - E element = getOtherElements()[0]; + final List list = makeFullCollection(); + final E element = getOtherElements()[0]; try { list.set(-1, element); fail("List.set should throw IndexOutOfBoundsException [-1]"); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { // expected } } Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java?rev=1429905&r1=1429904&r2=1429905&view=diff ============================================================================== --- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java (original) +++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/list/NodeCachingLinkedListTest.java Mon Jan 7 17:15:14 2013 @@ -33,7 +33,7 @@ import org.apache.commons.collections.Bu */ public class NodeCachingLinkedListTest extends AbstractLinkedListTest { - public NodeCachingLinkedListTest(String testName) { + public NodeCachingLinkedListTest(final String testName) { super(testName); } @@ -59,7 +59,7 @@ public class NodeCachingLinkedListTest list = getCollection(); + final NodeCachingLinkedList list = getCollection(); list.addAll(Arrays.asList((E[]) new String[] { "1", "2", "3", "4" })); list.removeAllNodes(); // Will dump all 4 elements into cache @@ -76,13 +76,13 @@ public class NodeCachingLinkedListTest ncll = new NodeCachingLinkedList(); - LinkedList ll = new LinkedList(); + final NodeCachingLinkedList ncll = new NodeCachingLinkedList(); + final LinkedList ll = new LinkedList(); - Object o1 = new Object(); - Object o2 = new Object(); + final Object o1 = new Object(); + final Object o2 = new Object(); - int loopCount = 4000000; + final int loopCount = 4000000; long startTime, endTime;