This is an automated email from the ASF dual-hosted git repository. aherbert 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 37cd2d8dc Fix flaky test in CollectionUtilsTest (#360) 37cd2d8dc is described below commit 37cd2d8dc1ed51a562ccc46f8520b8a9f08226ac Author: yannizhou05 <61256379+yannizho...@users.noreply.github.com> AuthorDate: Tue Nov 15 12:35:41 2022 -0600 Fix flaky test in CollectionUtilsTest (#360) --- .../java/org/apache/commons/collections4/CollectionUtilsTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java index 27ca6d910..20af9a1e5 100644 --- a/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java +++ b/src/test/java/org/apache/commons/collections4/CollectionUtilsTest.java @@ -687,7 +687,10 @@ public class CollectionUtilsTest extends MockTestCase { assertEquals(2, CollectionUtils.get((Object) collectionA, 2)); assertEquals(2, CollectionUtils.get((Object) collectionA.iterator(), 2)); final Map<Integer, Integer> map = CollectionUtils.getCardinalityMap(collectionA); - assertEquals(map.entrySet().iterator().next(), CollectionUtils.get((Object) map, 0)); + // Test assumes a defined iteration order so convert to a LinkedHashMap + final Map<Integer, Integer> linkedMap = new LinkedHashMap<>(); + linkedMap.putAll(map); + assertEquals(linkedMap.entrySet().iterator().next(), CollectionUtils.get((Object) linkedMap, 0)); } @Test