You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2020/12/05 15:31:00 UTC

[jira] [Resolved] (COLLECTIONS-775) CollectionUtilsTest.getFromMap() is flaky

     [ https://issues.apache.org/jira/browse/COLLECTIONS-775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved COLLECTIONS-775.
-----------------------------------------
    Fix Version/s: 4.5
       Resolution: Fixed

> CollectionUtilsTest.getFromMap() is flaky
> -----------------------------------------
>
>                 Key: COLLECTIONS-775
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-775
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Collection
>    Affects Versions: 4.4
>            Reporter: XinT
>            Priority: Minor
>              Labels: pull-request-available, test
>             Fix For: 4.5
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)