Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
4.4
Description
CollectionUtilsTest.getFromMap() is flaky on line 996: assertEquals(expected, found). We can get the following failure:
[ERROR] CollectionUtilsTest.getFromMap:996 expected:<{oneKey=one, zeroKey=zero}> but was:<{oneKey=one}>
The flakiness is introduced by calls to CollectionUtils.get(expected, 0) and CollectionUtils.get(expected, 1). Because CollectionUtils.get() uses a new Java Iterator each time it is called, it's possible that get(0) != get(0) and get(0) = get(1) in two subsequent calls to the "expected" HashMap. The end result is we may have only added {oneKey=one} or {zeroKey=zero}, but not both, to the "found" HashMap.