Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.58k stars 591 forks source link

Fix a flaky test. #408

Closed LALAYANG closed 2 years ago

LALAYANG commented 2 years ago
  1. The test Failure:

    • Run the test BehaviorTests.DefectTest.nullAndObjectValuesInMap with mvn -pl unirest edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=BehaviorTests.DefectTest#nullAndObjectValuesInMap
    • About NonDex.
    • Get some failures:
      [ERROR] Failures:
      [ERROR]   DefectTest.nullAndObjectValuesInMap:61 expected: <foo&baz=qux> but was: <baz=qux&foo>
      1. Why it fails:
    • In unirest/src/test/java/BehaviorTests/DefectTest.java : Map<String, Object> queryParams = new HashMap<>(); , HashMap makes no guarantee about the iteration order.
  2. Fix it:

    • By changing HashMap to LinkedHashMap.
CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.