Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed
Test
com.jakduk.api.GalleryOnListTest.자바배열객체를_JSON문자열로변환
was found flaky by an open-source research tool NonDex, which will shuffle implementation-dependent operations. The error was thrown by:assertEquals(expectResult, result);
at line 179. The flakiness was resulted from the random order of the fields stored inside the Hashmapsimage01
andimage02
. TheexpectedResult
used in the unit test was defined using a string with fixed order, and it will not match theresult
generated bymapper.writeValueAsString(images);
. The error messages:Fix of the problem
The fix was rather simple. Since it was totally due to the property of HashMap where its fields are stored in random orders. I changed the data structures of ``images01
and
images02``` from HashSet to LinkedHashSet. Besides, I modified the order of the ```expectedResult``` to match the sorted values of the LinkedHashMaps.Result of the fix
The test successed with Nondex runs for 3, 10, and 100 times. It can be safely concluded that the flakiness of this test is fixed
Test Environment:
Gradle 7.2
java OpenJDK 1.8.0_382
Linux 5.4.0-166-generic amd64