diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 381fd1a9e..91efdd7f1 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -21,6 +21,9 @@ + + Fix flaky UnmodifiableMultiValuedMapTest. + Bump actions/setup-java from v1.4.0 to v1.4.3 #174 #177 #186. 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 1fcbe20f5..5d87800c9 100644 --- a/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java +++ b/src/test/java/org/apache/commons/collections4/multimap/UnmodifiableMultiValuedMapTest.java @@ -47,7 +47,17 @@ public class UnmodifiableMultiValuedMapTest extends AbstractMultiValuedMap return BulkTest.makeSuite(UnmodifiableMultiValuedMapTest.class); } - // ----------------------------------------------------------------------- + /** + * Assert the given map contains all added values after it was initialized + * with makeFullMap(). See COLLECTIONS-769. + * @param map the MultiValuedMap to check + */ + private void assertMapContainsAllValues(MultiValuedMap map) { + assertEquals("[uno, un]", map.get((K) "one").toString()); + assertEquals("[dos, deux]", map.get((K) "two").toString()); + assertEquals("[tres, trois]", map.get((K) "three").toString()); + } + @Override public boolean isAddSupported() { return false; @@ -110,7 +120,7 @@ public class UnmodifiableMultiValuedMapTest extends AbstractMultiValuedMap // expected, not support remove() method // UnmodifiableMultiValuedMap does not support change } - assertEquals("{one=[uno, un], two=[dos, deux], three=[tres, trois]}", map.toString()); + this.assertMapContainsAllValues(map); } public void testRemoveMappingException() { @@ -122,7 +132,7 @@ public class UnmodifiableMultiValuedMapTest extends AbstractMultiValuedMap // expected, not support removeMapping() method // UnmodifiableMultiValuedMap does not support change } - assertEquals("{one=[uno, un], two=[dos, deux], three=[tres, trois]}", map.toString()); + this.assertMapContainsAllValues(map); } public void testClearException() { @@ -134,7 +144,7 @@ public class UnmodifiableMultiValuedMapTest extends AbstractMultiValuedMap // expected, not support clear() method // UnmodifiableMultiValuedMap does not support change } - assertEquals("{one=[uno, un], two=[dos, deux], three=[tres, trois]}", map.toString()); + this.assertMapContainsAllValues(map); } public void testPutAllException() {