diff --git a/src/test/java/org/apache/commons/collections4/iterators/CartesianProductIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/CartesianProductIteratorTest.java index fde5475ed4..42f981e250 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/CartesianProductIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/CartesianProductIteratorTest.java @@ -185,6 +185,7 @@ public void testExhaustivityWithSameList() { /** * test that all tuples are provided to consumer */ + @Override @Test public void testForEachRemaining() { final List resultsList = new ArrayList<>(); diff --git a/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java b/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java index de335229f2..96d45e4868 100644 --- a/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/map/LinkedMapTest.java @@ -153,7 +153,7 @@ public void testGetValueByIndex() { assertThrows(IndexOutOfBoundsException.class, () -> getMap().getValue(0)); assertThrows(IndexOutOfBoundsException.class, () -> getMap().getValue(-1)); resetFull(); - LinkedMap lm = getMap(); + final LinkedMap lm = getMap(); assertThrows(IndexOutOfBoundsException.class, () -> lm.getValue(-1)); assertThrows(IndexOutOfBoundsException.class, () -> lm.getValue(lm.size())); int i = 0; @@ -250,7 +250,7 @@ public void testRemoveByIndex() { assertThrows(IndexOutOfBoundsException.class, () -> getMap().remove(0)); assertThrows(IndexOutOfBoundsException.class, () -> getMap().remove(-1)); resetFull(); - LinkedMap lm = getMap(); + final LinkedMap lm = getMap(); assertThrows(IndexOutOfBoundsException.class, () -> lm.remove(-1)); assertThrows(IndexOutOfBoundsException.class, () -> lm.remove(lm.size())); final List list = new ArrayList<>(); diff --git a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedLinkedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedLinkedHashMapTest.java index 667ee882e6..9393519ac0 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedLinkedHashMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/ArrayListValuedLinkedHashMapTest.java @@ -195,7 +195,7 @@ public void testPreservesKeyInsertionOrder() { map.put((K) Integer.valueOf(5), (V) "five"); map.put((K) Integer.valueOf(1), (V) "one"); map.put((K) Integer.valueOf(5), (V) "vijf"); // "vijf" = "five" in Dutch - MapIterator mapIterator = map.mapIterator(); + final MapIterator mapIterator = map.mapIterator(); assertEquals(5, mapIterator.next()); assertEquals("five", mapIterator.getValue()); assertEquals(5, mapIterator.next()); diff --git a/src/test/java/org/apache/commons/collections4/multimap/LinkedHashSetValuedLinkedHashMapTest.java b/src/test/java/org/apache/commons/collections4/multimap/LinkedHashSetValuedLinkedHashMapTest.java index 15f1d367f0..05c3902010 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/LinkedHashSetValuedLinkedHashMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/LinkedHashSetValuedLinkedHashMapTest.java @@ -40,6 +40,11 @@ public LinkedHashSetValuedLinkedHashMapTest() { super(LinkedHashSetValuedLinkedHashMapTest.class.getSimpleName()); } + @Override + public String getCompatibilityVersion() { + return "4.5"; // LinkedHashSetValuedLinkedHashMap was added in version 4.5 + } + @Override protected int getIterationBehaviour() { return AbstractCollectionTest.UNORDERED; @@ -60,30 +65,6 @@ public SetValuedMap makeObject() { return new LinkedHashSetValuedLinkedHashMap<>(); } - @Override - public String getCompatibilityVersion() { - return "4.5"; // LinkedHashSetValuedLinkedHashMap was added in version 4.5 - } - - @Test - public void testLinkedHashSetValuedLinkedHashMap_2() { - final Map map = new HashMap<>(); - final SetValuedMap map1; - final SetValuedMap map2; - - map.put((K) "A", (V) "W"); - map.put((K) "B", (V) "X"); - map.put((K) "C", (V) "F"); - map1 = new LinkedHashSetValuedLinkedHashMap<>(map); - assertEquals(1, map1.get((K) "A").size()); - - map.remove("A"); - map.remove("B"); - map.remove("C"); - map2 = new LinkedHashSetValuedLinkedHashMap<>(map); - assertEquals("{}", map2.toString()); - } - @Test public void testHashSetValueHashMap() { final SetValuedMap setMap = new LinkedHashSetValuedLinkedHashMap<>(4); @@ -119,6 +100,25 @@ public void testHashSetValueHashMap_1() { assertEquals("{}", map3.toString()); } + @Test + public void testLinkedHashSetValuedLinkedHashMap_2() { + final Map map = new HashMap<>(); + final SetValuedMap map1; + final SetValuedMap map2; + + map.put((K) "A", (V) "W"); + map.put((K) "B", (V) "X"); + map.put((K) "C", (V) "F"); + map1 = new LinkedHashSetValuedLinkedHashMap<>(map); + assertEquals(1, map1.get((K) "A").size()); + + map.remove("A"); + map.remove("B"); + map.remove("C"); + map2 = new LinkedHashSetValuedLinkedHashMap<>(map); + assertEquals("{}", map2.toString()); + } + @Test @SuppressWarnings("unchecked") public void testSetValuedMapAdd() {