Fix flaky AbstractMultiValuedMapTest#testToString

This commit is contained in:
Xin Tong 2020-11-09 13:36:49 -06:00 committed by Bruno P. Kinoshita
parent 14ff6fae57
commit 9499397273
2 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,9 @@
</properties>
<body>
<release version="4.5" date="2020-MM-DD" description="Maintenance release.">
<action issue="COLLECTIONS-771" dev="kinow" type="fix" due-to="Xin Tong">
Fix flaky AbstractMultiValuedMapTest#testToString.
</action>
<action issue="COLLECTIONS-769" dev="kinow" type="fix" due-to="Xin (Cynthia) Tong">
Fix flaky UnmodifiableMultiValuedMapTest.
</action>

View File

@ -675,7 +675,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
map.put((K) "B", (V) "U");
map.put((K) "B", (V) "V");
map.put((K) "B", (V) "W");
assertEquals("{A=[X, Y, Z], B=[U, V, W]}", map.toString());
assertTrue(
"{A=[X, Y, Z], B=[U, V, W]}".equals(map.toString()) ||
"{B=[U, V, W], A=[X, Y, Z]}".equals(map.toString())
);
try {
final MultiValuedMap<K, V> originalNull = null;
@ -684,7 +687,10 @@ public abstract class AbstractMultiValuedMapTest<K, V> extends AbstractObjectTes
} catch (final NullPointerException npe) {
// expected
}
assertEquals("{A=[X, Y, Z], B=[U, V, W]}", map.toString());
assertTrue(
"{A=[X, Y, Z], B=[U, V, W]}".equals(map.toString()) ||
"{B=[U, V, W], A=[X, Y, Z]}".equals(map.toString())
);
map.remove("A");
map.remove("B");