Skip to content

Conversation

Nadim-Hasan
Copy link

Purpose

This PR fixes a flaky test in FragmentCollectorTest.

Issue

The test testWhereFragmentCollectorMerge was failing intermittently because
the order of parameters in a regular HashMap is not guaranteed. As a result,
the assertion sometimes failed when comparing expected vs actual entries.

How to Reproduce

  • Run the test multiple times with NonDex.
  • The test sometimes fails with parameter order mismatches (p1 vs p2).

Fix

  • Updated the implementation to use LinkedHashMap instead of HashMap.
  • LinkedHashMap preserves insertion order, ensuring deterministic results.

Result

  • The test now passes consistently.
  • No flaky behavior observed when running with NonDex.

@jeffgbutler
Copy link
Member

The description and title of this PR do not match the change. The change does not change the underlying implementation - it only changes the test.

I'm open to changing the test - changing from containsExactly to containsOnly is appropriate for a Map, but please update the PR so that is accurately describes the change. Also, please remove the commented out code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants