Repository: commons-collections Updated Branches: refs/heads/master 9e62a0e99 -> 059c468f7
http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java index e8119f3..0cb9ba6 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/PermutationIteratorTest.java @@ -73,11 +73,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character public void testPermutationResultSize() { int factorial = 1; for (int i = 0; i < 8; i++, factorial*=i) { - List<Integer> list = new ArrayList<>(); + final List<Integer> list = new ArrayList<>(); for (int j = 0; j < i; j++) { list.add(j); } - Iterator<List<Integer>> it = new PermutationIterator<>(list); + final Iterator<List<Integer>> it = new PermutationIterator<>(list); int count = 0; while (it.hasNext()) { it.next(); @@ -92,12 +92,12 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character */ @SuppressWarnings("boxing") // OK in test code public void testPermutationExhaustivity() { - List<Character> perm1 = new ArrayList<>(); - List<Character> perm2 = new ArrayList<>(); - List<Character> perm3 = new ArrayList<>(); - List<Character> perm4 = new ArrayList<>(); - List<Character> perm5 = new ArrayList<>(); - List<Character> perm6 = new ArrayList<>(); + final List<Character> perm1 = new ArrayList<>(); + final List<Character> perm2 = new ArrayList<>(); + final List<Character> perm3 = new ArrayList<>(); + final List<Character> perm4 = new ArrayList<>(); + final List<Character> perm5 = new ArrayList<>(); + final List<Character> perm6 = new ArrayList<>(); perm1.add('A'); perm2.add('A'); @@ -120,11 +120,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character perm5.add('B'); perm6.add('A'); - List<List<Character>> results = new ArrayList<>(); + final List<List<Character>> results = new ArrayList<>(); - PermutationIterator<Character> it = makeObject(); + final PermutationIterator<Character> it = makeObject(); while (it.hasNext()) { - List<Character> next = it.next(); + final List<Character> next = it.next(); results.add(next); } //3! permutation for 3 elements @@ -141,12 +141,12 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character * test checking that all the permutations are returned only once. */ public void testPermutationUnicity() { - List<List<Character>> resultsList = new ArrayList<>(); - Set<List<Character>> resultsSet = new HashSet<>(); + final List<List<Character>> resultsList = new ArrayList<>(); + final Set<List<Character>> resultsSet = new HashSet<>(); - PermutationIterator<Character> it = makeObject(); + final PermutationIterator<Character> it = makeObject(); while (it.hasNext()) { - List<Character> permutation = it.next(); + final List<Character> permutation = it.next(); resultsList.add(permutation); resultsSet.add(permutation); } @@ -156,24 +156,24 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character } public void testPermutationException() { - List<List<Character>> resultsList = new ArrayList<>(); + final List<List<Character>> resultsList = new ArrayList<>(); - PermutationIterator<Character> it = makeObject(); + final PermutationIterator<Character> it = makeObject(); while (it.hasNext()) { - List<Character> permutation = it.next(); + final List<Character> permutation = it.next(); resultsList.add(permutation); } //asking for another permutation should throw an exception try { it.next(); fail(); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { // expected } } public void testPermutatorHasMore() { - PermutationIterator<Character> it = makeObject(); + final PermutationIterator<Character> it = makeObject(); for (int i = 0; i < 6; i++) { assertTrue(it.hasNext()); it.next(); @@ -182,11 +182,11 @@ public class PermutationIteratorTest extends AbstractIteratorTest<List<Character } public void testEmptyCollection() { - PermutationIterator<Character> it = makeEmptyIterator(); + final PermutationIterator<Character> it = makeEmptyIterator(); // there is one permutation for an empty set: 0! = 1 assertTrue(it.hasNext()); - List<Character> nextPermutation = it.next(); + final List<Character> nextPermutation = it.next(); assertEquals(0, nextPermutation.size()); assertFalse(it.hasNext()); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java index 590fecf..668b00c 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/PushbackIteratorTest.java @@ -68,7 +68,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> { @Test public void testNormalIteration() { - PushbackIterator<E> iter = makeObject(); + final PushbackIterator<E> iter = makeObject(); assertEquals("a", iter.next()); assertEquals("b", iter.next()); assertEquals("c", iter.next()); @@ -78,7 +78,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> { @Test @SuppressWarnings("unchecked") public void testImmediatePushback() { - PushbackIterator<E> iter = makeObject(); + final PushbackIterator<E> iter = makeObject(); iter.pushback((E) "x"); assertEquals("x", iter.next()); assertEquals("a", iter.next()); @@ -88,7 +88,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> { @Test @SuppressWarnings("unchecked") public void testDelayedPushback() { - PushbackIterator<E> iter = makeObject(); + final PushbackIterator<E> iter = makeObject(); assertEquals("a", iter.next()); iter.pushback((E) "x"); assertEquals("x", iter.next()); @@ -99,7 +99,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> { @Test @SuppressWarnings("unchecked") public void testMultiplePushback() { - PushbackIterator<E> iter = makeObject(); + final PushbackIterator<E> iter = makeObject(); assertEquals("a", iter.next()); iter.pushback((E) "x"); iter.pushback((E) "y"); @@ -109,7 +109,7 @@ public class PushbackIteratorTest<E> extends AbstractIteratorTest<E> { validate(iter, "c"); } - private void validate(Iterator<E> iter, Object... items) { + private void validate(final Iterator<E> iter, final Object... items) { for (final Object x : items) { assertTrue(iter.hasNext()); assertEquals(x, iter.next()); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java index 052201a..c0ebf41 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java @@ -66,7 +66,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testSkipping() { - Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 2); + final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 2); assertTrue(iter.hasNext()); assertEquals("c", iter.next()); @@ -83,7 +83,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -94,7 +94,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testSameAsDecorated() { - Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 0); + final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 0); assertTrue(iter.hasNext()); assertEquals("a", iter.next()); @@ -115,7 +115,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -126,12 +126,12 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testOffsetGreaterThanSize() { - Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 10); + final Iterator<E> iter = new SkippingIterator<>(testList.iterator(), 10); assertFalse(iter.hasNext()); try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -144,7 +144,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { new SkippingIterator<>(testList.iterator(), -1); fail("Expected IllegalArgumentException."); - } catch (IllegalArgumentException iae) { /* Success case */ + } catch (final IllegalArgumentException iae) { /* Success case */ } } @@ -154,13 +154,13 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveWithoutCallingNext() { - List<E> testListCopy = new ArrayList<>(testList); - Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1); + final List<E> testListCopy = new ArrayList<>(testList); + final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1); try { iter.remove(); fail("Expected IllegalStateException."); - } catch (IllegalStateException ise) { /* Success case */ + } catch (final IllegalStateException ise) { /* Success case */ } } @@ -170,8 +170,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveCalledTwice() { - List<E> testListCopy = new ArrayList<>(testList); - Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1); + final List<E> testListCopy = new ArrayList<>(testList); + final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 1); assertTrue(iter.hasNext()); assertEquals("b", iter.next()); @@ -180,7 +180,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.remove(); fail("Expected IllegalStateException."); - } catch (IllegalStateException ise) { /* Success case */ + } catch (final IllegalStateException ise) { /* Success case */ } } @@ -190,8 +190,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveFirst() { - List<E> testListCopy = new ArrayList<>(testList); - Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 4); + final List<E> testListCopy = new ArrayList<>(testList); + final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 4); assertTrue(iter.hasNext()); assertEquals("e", iter.next()); @@ -208,7 +208,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -218,8 +218,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveMiddle() { - List<E> testListCopy = new ArrayList<>(testList); - Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 3); + final List<E> testListCopy = new ArrayList<>(testList); + final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 3); assertTrue(iter.hasNext()); assertEquals("d", iter.next()); @@ -238,7 +238,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -248,8 +248,8 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveLast() { - List<E> testListCopy = new ArrayList<>(testList); - Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 5); + final List<E> testListCopy = new ArrayList<>(testList); + final Iterator<E> iter = new SkippingIterator<>(testListCopy.iterator(), 5); assertTrue(iter.hasNext()); assertEquals("f", iter.next()); @@ -260,7 +260,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } iter.remove(); @@ -270,7 +270,7 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { try { iter.next(); fail("Expected NoSuchElementException."); - } catch (NoSuchElementException nsee) { /* Success case */ + } catch (final NoSuchElementException nsee) { /* Success case */ } } @@ -280,20 +280,20 @@ public class SkippingIteratorTest<E> extends AbstractIteratorTest<E> { */ @Test public void testRemoveUnsupported() { - Iterator<E> mockIterator = new AbstractIteratorDecorator<E>(testList.iterator()) { + final Iterator<E> mockIterator = new AbstractIteratorDecorator<E>(testList.iterator()) { @Override public void remove() { throw new UnsupportedOperationException(); } }; - Iterator<E> iter = new SkippingIterator<>(mockIterator, 1); + final Iterator<E> iter = new SkippingIterator<>(mockIterator, 1); assertTrue(iter.hasNext()); assertEquals("b", iter.next()); try { iter.remove(); fail("Expected UnsupportedOperationException."); - } catch (UnsupportedOperationException usoe) { /* Success case */ + } catch (final UnsupportedOperationException usoe) { /* Success case */ } } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java index 104acf2..59d3eb3 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/ZippingIteratorTest.java @@ -100,7 +100,7 @@ public class ZippingIteratorTest extends AbstractIteratorTest<Integer> { final ZippingIterator<Integer> iter = new ZippingIterator<>(odds.iterator(), evens.iterator()); for (int i = 0, j = 0; i < 20; i++) { assertTrue(iter.hasNext()); - int val = iter.next(); + final int val = iter.next(); if (i % 2 == 0) { assertEquals(odds.get(j).intValue(), val); } else { http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java index 49159bd..dc7f2ec 100644 --- a/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java +++ b/src/test/java/org/apache/commons/collections4/keyvalue/MultiKeyTest.java @@ -258,7 +258,7 @@ public class MultiKeyTest extends TestCase { private static final long serialVersionUID = 1928896152249821416L; - public DerivedMultiKey(T key1, T key2) { + public DerivedMultiKey(final T key1, final T key2) { super(key1, key2); } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java index ccd53cd..15b608c 100644 --- a/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/AbstractListTest.java @@ -472,7 +472,7 @@ public abstract class AbstractListTest<E> extends AbstractCollectionTest<E> { final List<E> list1 = getCollection(); final List<E> list2 = getConfirmed(); - for (E element : list2) { + for (final E element : list2) { assertEquals("indexOf should return correct result", list1.indexOf(element), list2.indexOf(element)); verify(); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java index 01b5e2f..1207dc8 100644 --- a/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/SetUniqueListTest.java @@ -463,11 +463,11 @@ public class SetUniqueListTest<E> extends AbstractListTest<E> { public void testSubListIsUnmodifiable() { resetFull(); - List<E> subList = getCollection().subList(1, 3); + final List<E> subList = getCollection().subList(1, 3); try { subList.remove(0); fail("subList should be unmodifiable"); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { // expected } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/list/TreeListTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/list/TreeListTest.java b/src/test/java/org/apache/commons/collections4/list/TreeListTest.java index b077b7a..5b0dba9 100644 --- a/src/test/java/org/apache/commons/collections4/list/TreeListTest.java +++ b/src/test/java/org/apache/commons/collections4/list/TreeListTest.java @@ -273,20 +273,20 @@ public class TreeListTest<E> extends AbstractListTest<E> { // when initializing the TreeList with another collection for (int size = 1; size < 1000; size++) { - List<Integer> other = new ArrayList<>(size); + final List<Integer> other = new ArrayList<>(size); for (int i = 0; i < size; i++) { other.add(i); } - TreeList<Integer> l = new TreeList<>(other); - ListIterator<Integer> it = l.listIterator(); + final TreeList<Integer> l = new TreeList<>(other); + final ListIterator<Integer> it = l.listIterator(); int i = 0; while (it.hasNext()) { - Integer val = it.next(); + final Integer val = it.next(); assertEquals(i++, val.intValue()); } while (it.hasPrevious()) { - Integer val = it.previous(); + final Integer val = it.previous(); assertEquals(--i, val.intValue()); } } @@ -301,28 +301,28 @@ public class TreeListTest<E> extends AbstractListTest<E> { // to simulate different cases in addAll, do different runs where // the number of elements already in the list and being added by addAll differ - int size = 1000; + final int size = 1000; for (int i = 0; i < 100; i++) { - List<Integer> other = new ArrayList<>(size); + final List<Integer> other = new ArrayList<>(size); for (int j = i; j < size; j++) { other.add(j); } - TreeList<Integer> l = new TreeList<>(); + final TreeList<Integer> l = new TreeList<>(); for (int j = 0; j < i; j++) { l.add(j); } l.addAll(other); - ListIterator<Integer> it = l.listIterator(); + final ListIterator<Integer> it = l.listIterator(); int cnt = 0; while (it.hasNext()) { - Integer val = it.next(); + final Integer val = it.next(); assertEquals(cnt++, val.intValue()); } while (it.hasPrevious()) { - Integer val = it.previous(); + final Integer val = it.previous(); assertEquals(--cnt, val.intValue()); } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java index ccd1fc3..50c09af 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractMapTest.java @@ -624,14 +624,14 @@ public abstract class AbstractMapTest<K, V> extends AbstractObjectTest { final Object[] keys = getSampleKeys(); resetEmpty(); - for (Object key : keys) { + for (final Object key : keys) { assertTrue("Map must not contain key when map is empty", !getMap().containsKey(key)); } verify(); resetFull(); - for (Object key : keys) { + for (final Object key : keys) { assertTrue("Map must contain key for a mapping in the map. " + "Missing: " + key, getMap().containsKey(key)); } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java index 7a33ae4..86a9bb9 100644 --- a/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/AbstractSortedMapTest.java @@ -90,7 +90,7 @@ public abstract class AbstractSortedMapTest<K, V> extends AbstractMapTest<K, V> public void testLastKey() { final SortedMap<K, V> sm = makeFullMap(); K obj = null; - for (K k : sm.keySet()) { + for (final K k : sm.keySet()) { obj = k; } assertSame(obj, sm.lastKey()); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java index 46368c8..e7ed44c 100644 --- a/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LRUMapTest.java @@ -74,42 +74,42 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> { try { new LRUMap<K, V>(0); fail("maxSize must be positive"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } try { new LRUMap<K, V>(-1, 12, 0.75f, false); fail("maxSize must be positive"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } try { new LRUMap<K, V>(10, -1); fail("initialSize must not be negative"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } try { new LRUMap<K, V>(10, 12); fail("initialSize must not be larger than maxSize"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } try { new LRUMap<K, V>(10, -1, 0.75f, false); fail("initialSize must not be negative"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } try { new LRUMap<K, V>(10, 12, 0.75f, false); fail("initialSize must not be larger than maxSize"); - } catch(IllegalArgumentException ex) { + } catch(final IllegalArgumentException ex) { // expected } } @@ -280,7 +280,7 @@ public class LRUMapTest<K, V> extends AbstractOrderedMapTest<K, V> { Iterator<V> vit = null; resetEmpty(); - LRUMap<K, V> lruMap = (LRUMap<K, V>) map; + final LRUMap<K, V> lruMap = (LRUMap<K, V>) map; lruMap.put(keys[0], values[0]); lruMap.put(keys[1], values[1]); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java index a79227b..b0238c6 100644 --- a/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/ListOrderedMapTest.java @@ -386,13 +386,13 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> { } public void testCOLLECTIONS_474_nullValues () { - Object key1 = new Object(); - Object key2 = new Object(); - HashMap<Object, Object> hmap = new HashMap<>(); + final Object key1 = new Object(); + final Object key2 = new Object(); + final HashMap<Object, Object> hmap = new HashMap<>(); hmap.put(key1, null); hmap.put(key2, null); assertEquals("Should have two elements", 2, hmap.size()); - ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>(); + final ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>(); listMap.put(key1, null); listMap.put(key2, null); assertEquals("Should have two elements", 2, listMap.size()); @@ -400,13 +400,13 @@ public class ListOrderedMapTest<K, V> extends AbstractOrderedMapTest<K, V> { } public void testCOLLECTIONS_474_nonNullValues () { - Object key1 = new Object(); - Object key2 = new Object(); - HashMap<Object, Object> hmap = new HashMap<>(); + final Object key1 = new Object(); + final Object key2 = new Object(); + final HashMap<Object, Object> hmap = new HashMap<>(); hmap.put(key1, "1"); hmap.put(key2, "2"); assertEquals("Should have two elements", 2, hmap.size()); - ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>(); + final ListOrderedMap<Object, Object> listMap = new ListOrderedMap<>(); listMap.put(key1, "3"); listMap.put(key2, "4"); assertEquals("Should have two elements", 2, listMap.size()); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java index aae2239..dc57e0a 100644 --- a/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/MultiValueMapTest.java @@ -152,10 +152,11 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest { public void testIterator() { final MultiValueMap<K, V> map = createTestMap(); @SuppressWarnings("unchecked") + final Collection<V> values = new ArrayList<>((Collection<V>) map.values()); - Iterator<Map.Entry<K, V>> iterator = map.iterator(); + final Iterator<Map.Entry<K, V>> iterator = map.iterator(); while (iterator.hasNext()) { - Map.Entry<K, V> entry = iterator.next(); + final Map.Entry<K, V> entry = iterator.next(); assertTrue(map.containsValue(entry.getKey(), entry.getValue())); assertTrue(values.contains(entry.getValue())); assertTrue(values.remove(entry.getValue())); @@ -392,24 +393,24 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest { } public void testUnsafeDeSerialization() throws Exception { - MultiValueMap map1 = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class); + final MultiValueMap map1 = MultiValueMap.multiValueMap(new HashMap(), ArrayList.class); byte[] bytes = serialize(map1); Object result = deserialize(bytes); assertEquals(map1, result); - MultiValueMap map2 = MultiValueMap.multiValueMap(new HashMap(), (Class) String.class); + final MultiValueMap map2 = MultiValueMap.multiValueMap(new HashMap(), (Class) String.class); bytes = serialize(map2); try { result = deserialize(bytes); fail("unsafe clazz accepted when de-serializing MultiValueMap"); - } catch (UnsupportedOperationException ex) { + } catch (final UnsupportedOperationException ex) { // expected } } - private byte[] serialize(Object object) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(baos); + private byte[] serialize(final Object object) throws IOException { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(object); oos.close(); @@ -417,9 +418,9 @@ public class MultiValueMapTest<K, V> extends AbstractObjectTest { return baos.toByteArray(); } - private Object deserialize(byte[] data) throws IOException, ClassNotFoundException { - ByteArrayInputStream bais = new ByteArrayInputStream(data); - ObjectInputStream iis = new ObjectInputStream(bais); + private Object deserialize(final byte[] data) throws IOException, ClassNotFoundException { + final ByteArrayInputStream bais = new ByteArrayInputStream(data); + final ObjectInputStream iis = new ObjectInputStream(bais); return iis.readObject(); } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java index 789d294..f09105c 100644 --- a/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/PassiveExpiringMapTest.java @@ -234,14 +234,14 @@ public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> { new PassiveExpiringMap.ConstantTimeToLiveExpirationPolicy<String, String>(1, TimeUnit.SECONDS)), 1000); } - private void validateExpiration(final Map<String, String> map, long timeout) { + private void validateExpiration(final Map<String, String> map, final long timeout) { map.put("a", "b"); assertNotNull(map.get("a")); try { Thread.sleep(2 * timeout); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { fail(); } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java index 286c0b3..260947c 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedHashMapTest.java @@ -32,7 +32,7 @@ import org.apache.commons.collections4.MultiValuedMap; */ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> { - public ArrayListValuedHashMapTest(String testName) { + public ArrayListValuedHashMapTest(final String testName) { super(testName); } @@ -51,7 +51,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest public void testListValuedMapAdd() { final ListValuedMap<K, V> listMap = makeObject(); assertTrue(listMap.get((K) "whatever") instanceof List); - List<V> list = listMap.get((K) "A"); + final List<V> list = listMap.get((K) "A"); list.add((V) "a1"); assertEquals(1, listMap.size()); assertTrue(listMap.containsKey("A")); @@ -60,7 +60,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest @SuppressWarnings("unchecked") public void testListValuedMapAddViaListIterator() { final ListValuedMap<K, V> listMap = makeObject(); - ListIterator<V> listIt = listMap.get((K) "B").listIterator(); + final ListIterator<V> listIt = listMap.get((K) "B").listIterator(); assertFalse(listIt.hasNext()); listIt.add((V) "b1"); listIt.add((V) "b2"); @@ -74,7 +74,7 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest @SuppressWarnings("unchecked") public void testListValuedMapRemove() { final ListValuedMap<K, V> listMap = makeObject(); - List<V> list = listMap.get((K) "A"); + final List<V> list = listMap.get((K) "A"); list.add((V) "a1"); list.add((V) "a2"); list.add((V) "a3"); @@ -110,8 +110,8 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest @SuppressWarnings({ "unchecked", "rawtypes" }) public void testEqualsHashCodeContract() { - MultiValuedMap map1 = makeObject(); - MultiValuedMap map2 = makeObject(); + final MultiValuedMap map1 = makeObject(); + final MultiValuedMap map2 = makeObject(); map1.put("a", "a1"); map1.put("a", "a2"); @@ -127,8 +127,8 @@ public class ArrayListValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest @SuppressWarnings({ "unchecked", "rawtypes" }) public void testListValuedMapEqualsHashCodeContract() { - ListValuedMap map1 = makeObject(); - ListValuedMap map2 = makeObject(); + final ListValuedMap map1 = makeObject(); + final ListValuedMap map2 = makeObject(); map1.put("a", "a1"); map1.put("a", "a2"); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java index 61d5538..2a46641 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/HashSetValuedHashMapTest.java @@ -32,7 +32,7 @@ import org.apache.commons.collections4.SetValuedMap; */ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> { - public HashSetValuedHashMapTest(String testName) { + public HashSetValuedHashMapTest(final String testName) { super(testName); } @@ -57,7 +57,7 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K final SetValuedMap<K, V> setMap = makeObject(); assertTrue(setMap.get((K) "whatever") instanceof Set); - Set<V> set = setMap.get((K) "A"); + final Set<V> set = setMap.get((K) "A"); assertTrue(set.add((V) "a1")); assertTrue(set.add((V) "a2")); assertFalse(set.add((V) "a1")); @@ -70,7 +70,7 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K final SetValuedMap<K, V> setMap = makeObject(); assertTrue(setMap.get((K) "whatever") instanceof Set); - Set<V> set = setMap.get((K) "A"); + final Set<V> set = setMap.get((K) "A"); assertTrue(set.add((V) "a1")); assertTrue(set.add((V) "a2")); assertFalse(set.add((V) "a1")); @@ -90,12 +90,12 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K final SetValuedMap<K, V> setMap = makeObject(); assertTrue(setMap.get((K) "whatever") instanceof Set); - Set<V> set = setMap.get((K) "A"); + final Set<V> set = setMap.get((K) "A"); set.add((V) "a1"); set.add((V) "a2"); set.add((V) "a1"); - Iterator<V> it = set.iterator(); + final Iterator<V> it = set.iterator(); while (it.hasNext()) { it.next(); it.remove(); @@ -106,8 +106,8 @@ public class HashSetValuedHashMapTest<K, V> extends AbstractMultiValuedMapTest<K @SuppressWarnings({ "unchecked", "rawtypes" }) public void testSetValuedMapEqualsHashCodeContract() { - SetValuedMap map1 = makeObject(); - SetValuedMap map2 = makeObject(); + final SetValuedMap map1 = makeObject(); + final SetValuedMap map2 = makeObject(); map1.put("a", "a1"); map1.put("a", "a2"); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java index 55ee3a2..ed0723e 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java @@ -33,7 +33,7 @@ import org.apache.commons.collections4.collection.TransformedCollectionTest; */ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> { - public TransformedMultiValuedMapTest(String testName) { + public TransformedMultiValuedMapTest(final String testName) { super(testName); } @@ -53,7 +53,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT public void testKeyTransformedMap() { final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; - MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap( + final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap( new ArrayListValuedHashMap<K, V>(), (Transformer<? super K, ? extends K>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER, null); @@ -67,7 +67,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT assertEquals(true, map.get((K) Integer.valueOf((String) els[i])).contains(els[i])); } - Collection<V> coll = map.remove(els[0]); + final Collection<V> coll = map.remove(els[0]); assertNotNull(coll); assertEquals(0, coll.size()); assertEquals(true, map.remove(Integer.valueOf((String) els[0])).contains(els[0])); @@ -77,7 +77,7 @@ public class TransformedMultiValuedMapTest<K, V> extends AbstractMultiValuedMapT public void testValueTransformedMap() { final Object[] els = new Object[] { "1", "3", "5", "7", "2", "4", "6" }; - MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap( + final MultiValuedMap<K, V> map = TransformedMultiValuedMap.transformingMap( new ArrayListValuedHashMap<K, V>(), null, (Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER); assertEquals(0, map.size()); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java index 9818e12..260d9ae 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java @@ -38,7 +38,7 @@ import org.apache.commons.collections4.Unmodifiable; */ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMapTest<K, V> { - public UnmodifiableMultiValuedMapTest(String testName) { + public UnmodifiableMultiValuedMapTest(final String testName) { super(testName); } @@ -85,179 +85,179 @@ public class UnmodifiableMultiValuedMapTest<K, V> extends AbstractMultiValuedMap try { UnmodifiableMultiValuedMap.unmodifiableMultiValuedMap(null); fail("map must not be null"); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { // expected } } @SuppressWarnings("unchecked") public void testAddException() { - MultiValuedMap<K, V> map = makeObject(); + final MultiValuedMap<K, V> map = makeObject(); try { map.put((K) "one", (V) "uno"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableEntries() { resetFull(); - Collection<Entry<K, V>> entries = getMap().entries(); + final Collection<Entry<K, V>> entries = getMap().entries(); try { entries.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } - Iterator<Entry<K, V>> it = entries.iterator(); - Entry<K, V> entry = it.next(); + final Iterator<Entry<K, V>> it = entries.iterator(); + final Entry<K, V> entry = it.next(); try { it.remove(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { entry.setValue((V) "three"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableMapIterator() { resetFull(); - MapIterator<K, V> mapIt = getMap().mapIterator(); + final MapIterator<K, V> mapIt = getMap().mapIterator(); try { mapIt.remove(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { mapIt.setValue((V) "three"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableKeySet() { resetFull(); - Set<K> keySet = getMap().keySet(); + final Set<K> keySet = getMap().keySet(); try { keySet.add((K) "four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { keySet.remove("four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { keySet.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } - Iterator<K> it = keySet.iterator(); + final Iterator<K> it = keySet.iterator(); try { it.remove(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableValues() { resetFull(); - Collection<V> values = getMap().values(); + final Collection<V> values = getMap().values(); try { values.add((V) "four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { values.remove("four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { values.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } - Iterator<V> it = values.iterator(); + final Iterator<V> it = values.iterator(); try { it.remove(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableAsMap() { resetFull(); - Map<K, Collection<V>> mapCol = getMap().asMap(); + final Map<K, Collection<V>> mapCol = getMap().asMap(); try { mapCol.put((K) "four", (Collection<V>) Arrays.asList("four")); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { mapCol.remove("four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { mapCol.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { mapCol.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } @SuppressWarnings("unchecked") public void testUnmodifiableKeys() { resetFull(); - MultiSet<K> keys = getMap().keys(); + final MultiSet<K> keys = getMap().keys(); try { keys.add((K) "four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { keys.remove("four"); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } try { keys.clear(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } - Iterator<K> it = keys.iterator(); + final Iterator<K> it = keys.iterator(); try { it.remove(); fail(); - } catch (UnsupportedOperationException e) { + } catch (final UnsupportedOperationException e) { } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java index 7ae0e7b..9c41c38 100644 --- a/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/AbstractQueueTest.java @@ -72,7 +72,7 @@ public abstract class AbstractQueueTest<E> extends AbstractCollectionTest<E> { public void verify() { super.verify(); final Iterator<E> iterator1 = getCollection().iterator(); - for (E e : getConfirmed()) { + for (final E e : getConfirmed()) { assertTrue(iterator1.hasNext()); final Object o1 = iterator1.next(); final Object o2 = e; http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java index ac51874..e38ade4 100644 --- a/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java +++ b/src/test/java/org/apache/commons/collections4/queue/CircularFifoQueueTest.java @@ -48,7 +48,7 @@ public class CircularFifoQueueTest<E> extends AbstractQueueTest<E> { public void verify() { super.verify(); final Iterator<E> iterator1 = getCollection().iterator(); - for (E e : getConfirmed()) { + for (final E e : getConfirmed()) { assertTrue(iterator1.hasNext()); final Object o1 = iterator1.next(); final Object o2 = e; http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java index f2795ec..88bb25a 100644 --- a/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/sequence/SequencesComparatorTest.java @@ -130,7 +130,7 @@ public class SequencesComparatorTest { final ExecutionVisitor<String> ev = new ExecutionVisitor<>(); for (int i = 0; i < shadokSentences.size(); ++i) { - for (List<String> shadokSentence : shadokSentences) { + for (final List<String> shadokSentence : shadokSentences) { ev.setList(shadokSentences.get(i)); new SequencesComparator<>(shadokSentences.get(i), shadokSentence).getScript().visit(ev); http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/set/AbstractSetTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/set/AbstractSetTest.java b/src/test/java/org/apache/commons/collections4/set/AbstractSetTest.java index cea912a..089b919 100644 --- a/src/test/java/org/apache/commons/collections4/set/AbstractSetTest.java +++ b/src/test/java/org/apache/commons/collections4/set/AbstractSetTest.java @@ -62,7 +62,7 @@ public abstract class AbstractSetTest<E> extends AbstractCollectionTest<E> { assertEquals("Sets should have equal hashCodes", getConfirmed().hashCode(), getCollection().hashCode()); final Collection<E> set = makeConfirmedCollection(); - for (E element : getCollection()) { + for (final E element : getCollection()) { assertTrue("Set.iterator should only return unique elements", set.add(element)); } } http://git-wip-us.apache.org/repos/asf/commons-collections/blob/059c468f/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java index cbe8023..04cb3ad 100755 --- a/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java +++ b/src/test/java/org/apache/commons/collections4/trie/PatriciaTrieTest.java @@ -331,7 +331,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { public void testPrefixMapSizes() { // COLLECTIONS-525 - PatriciaTrie<String> aTree = new PatriciaTrie<>(); + final PatriciaTrie<String> aTree = new PatriciaTrie<>(); aTree.put("ç¹è¯", "æµè¯"); aTree.put("书è¯", "æµè¯"); assertTrue(aTree.prefixMap("ç¹").containsKey("ç¹è¯")); @@ -370,7 +370,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { } public void testPrefixMapClear() { - Trie<String, Integer> trie = new PatriciaTrie<>(); + final Trie<String, Integer> trie = new PatriciaTrie<>(); trie.put("Anna", 1); trie.put("Anael", 2); trie.put("Analu", 3); @@ -378,7 +378,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { trie.put("Andrea", 5); trie.put("Andres", 6); trie.put("Anatole", 7); - SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); + final SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); assertEquals(new HashSet<>(Arrays.asList("Andrea", "Andreas", "Andres")), prefixMap.keySet()); assertEquals(Arrays.asList(5, 4, 6), new ArrayList<>(prefixMap.values())); @@ -391,8 +391,8 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { } public void testPrefixMapClearNothing() { - Trie<String, Integer> trie = new PatriciaTrie<>(); - SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); + final Trie<String, Integer> trie = new PatriciaTrie<>(); + final SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); assertEquals(new HashSet<String>(), prefixMap.keySet()); assertEquals(new ArrayList<Integer>(0), new ArrayList<>(prefixMap.values())); @@ -405,7 +405,7 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { } public void testPrefixMapClearUsingRemove() { - Trie<String, Integer> trie = new PatriciaTrie<>(); + final Trie<String, Integer> trie = new PatriciaTrie<>(); trie.put("Anna", 1); trie.put("Anael", 2); trie.put("Analu", 3); @@ -413,11 +413,11 @@ public class PatriciaTrieTest<V> extends AbstractSortedMapTest<String, V> { trie.put("Andrea", 5); trie.put("Andres", 6); trie.put("Anatole", 7); - SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); + final SortedMap<String, Integer> prefixMap = trie.prefixMap("And"); assertEquals(new HashSet<>(Arrays.asList("Andrea", "Andreas", "Andres")), prefixMap.keySet()); assertEquals(Arrays.asList(5, 4, 6), new ArrayList<>(prefixMap.values())); - Set<String> keys = new HashSet<>(prefixMap.keySet()); + final Set<String> keys = new HashSet<>(prefixMap.keySet()); for (final String key : keys) { prefixMap.remove(key); }