Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed flaky test in ToStringBuilderTest.java #3496

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

mumbler6
Copy link
Contributor

The order of items in the map variable for the ParamStore class is indeterministic, causing the map_recurse() test case to sometimes fail. Since map is a HashMap and the items inside are unordered, the conversion to string doesn't always guarantee the same string.

This PR proposes to change the map variable from a HashMap to a LinkedHashMap, preserving the ordering of insertion and removing the flakiness of the test.

This change was confirmed by running the NonDex tool, which explores and reports errors in different behaviors of under-determined Java APIs.

To reproduce this problem, you can run the test with NonDex using this command:

mvn edu.illinois:nondex-maven-plugin:2.1.7:nondex -pl ebean-api -Dtest=io.ebean.bean.ToStringBuilderTest#map_recurse

Here are screenshots of the outputs produced by NonDex before and after the fix:

image

image

Please let me know if you'd like to discuss the fix.

@rbygrave
Copy link
Member

Nice, thanks !!

@rbygrave rbygrave merged commit e0a00be into ebean-orm:master Oct 17, 2024
1 check passed
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