Skip to content

Conversation

@kaiyaok2
Copy link
Owner

@kaiyaok2 kaiyaok2 commented Feb 4, 2022

Description
3 flaky tests are found using Nondex when running commands
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex
The reasons for test flakiness are that Java Hashmap API do not preserve the order of the key-value pairs, and that Java Set API does not preserve the order of elements. Comparing maps or sets with strings can fail when, for example, the Java version upgrades in the future, or when the code is run in different environments.

Flaky Tests and Fixes
Using TreeSet instead of Set, and using LinkedHashMap instead of HashMap to ensure deterministic behavior in tests.

@kaiyaok2 kaiyaok2 merged commit 7926c7d into master Feb 19, 2022
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