Skip to content

Update ArrayConverterTest.java#1

Open
yannizhou05 wants to merge 2 commits intomasterfrom
fix-flaky
Open

Update ArrayConverterTest.java#1
yannizhou05 wants to merge 2 commits intomasterfrom
fix-flaky

Conversation

@yannizhou05
Copy link
Owner

@yannizhou05 yannizhou05 commented Oct 14, 2022

The tests below were found flaky because of the ordering of HashSets and HashMaps. The orders of elements in the HashSets and HashMaps are not the same every time being called. In this case, HashSet is changed into LinkedHashSet, and the unordered results from HashMap are sorted for comparing. This code change is trying to fix the flaky tests mentioned above, because they sometimes fail (as the picture showed) and sometimes pass when comparing the strings. The failure could be reproduced by the commands above by using the tool of NonDex. The code change is to make sure the tests will always pass in this case.

  • org.modelmapper.internal.converter.ArrayConverterTest.shouldConvertFromSet
  • org.modelmapper.internal.TypeInfoImplTest.shouldProduceMutators
  • org.modelmapper.internal.TypeInfoImplTest.shouldProduceAccessors

The test failures could be reproduced by

  1. mvn install -pl . -am -DskipTests
  2. run tests with NonDex
    mvn -pl core edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=org.modelmapper.internal.TypeInfoImplTest#shouldProduceAccessors

1

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.

1 participant