Description
Overview of PR
This PR proposes a fix for the following tests:
- org.apache.commons.collections4.multimap.TransformedMultiValuedMapTest.testMultiValuedMapIterator
- org.apache.commons.collections4.multimap.ArrayListValuedHashMapTest.testMultiValuedMapIterator
Problem:
In this test, a multivalued map is defined and an iterator is defined on top of that. The test is flaky since the order inside the multivalued map is not maintained.
Since the order is not maintained, the iterator can have any one key of the three keys for this test ( one, two, three) in random fashion. This flakiness was identified by the nondex tool created by the researchers of UIUC.
Fix:
To maintain order, we can implement a TreeMap or a LinkedHashMap but that will change the base code and affect all other entities related to this.
This PR proposes a fix inside the test while keeping the test logic intact. Since the order is not maintained, we check for the iterator's next value to either be one of the keys and if it is, we check the original assert statements. We follow the same approach to assert all the cases.
Attachments
Issue Links
- links to