You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2020/10/12 02:27:10 UTC
[commons-collections] branch master updated: [COLLECTIONS-769] Fix
flaky UnmodifiableMultiValuedMapTest
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git
The following commit(s) were added to refs/heads/master by this push:
new e52e38b [COLLECTIONS-769] Fix flaky UnmodifiableMultiValuedMapTest
new 7e953fd Merge branch 'pr-190'
e52e38b is described below
commit e52e38bdbb8d6a6a37ddaecebee7e498f55dda12
Author: Xin Tong <xi...@illinois.edu>
AuthorDate: Thu Oct 8 12:42:03 2020 -0500
[COLLECTIONS-769] Fix flaky UnmodifiableMultiValuedMapTest
---
src/changes/changes.xml | 3 +++
.../multimap/UnmodifiableMultiValuedMapTest.java | 18 ++++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 381fd1a..91efdd7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -21,6 +21,9 @@
</properties>
<body>
<release version="4.5" date="2020-MM-DD" description="Maintenance release.">
+ <action issue="COLLECTIONS-769" dev="kinow" type="fix" due-to="Xin (Cynthia) Tong">
+ Fix flaky UnmodifiableMultiValuedMapTest.
+ </action>
<action type="update" dev="kinow" due-to="Dependabot">
Bump actions/setup-java from v1.4.0 to v1.4.3 #174 #177 #186.
</action>
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 1fcbe20..5d87800 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<K, V> 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<K, V> to check
+ */
+ private void assertMapContainsAllValues(MultiValuedMap<K, V> 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<K, V> 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<K, V> 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<K, V> 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() {