Skip to content

Conversation

@LALAYANG
Copy link
Owner

  1. The test Failure:
  • Run the test com.github.underscore.ArraysTest.replace with:
    mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=com.github.underscore.ArraysTest#replace
    Here are the details of NonDex.
  • Get some failures:
    Failed tests: replace(com.github.underscore.ArraysTest): expected:<[[0, 1, 2, 10]0, 100, 100, 100]> but was:<[[100, 2, 1, ]0, 100, 100, 100]>
  1. Why it fails:
  • In src/test/java/com/github/underscore/ArraysTest.java : Set<Integer> set = new HashSet<>(); , HashSet makes no guarantee about the iteration order. The specification about HashSet says that "It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time".
  1. Fix it:
  • By changing HashSet into LinkedHashSet.

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