Skip to content

Commit 4ac0fbd

Browse files
Fix flakiness in CollectorContextTest (#489)
`testCollectorContextWithKeyword` was failing under [NonDex](https://github.com/TestingResearchIllinois/NonDex) due to implementation-defined ordering of the list of context values. This PR fixes that flakiness by sorting the list in natural order before inspecting it.
1 parent 0c2a855 commit 4ac0fbd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/test/java/com/networknt/schema/CollectorContextTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void testCollectorContextWithKeyword() throws Exception {
5656
ValidationResult validationResult = validate("{\"test-property1\":\"sample1\",\"test-property2\":\"sample2\"}");
5757
Assertions.assertEquals(0, validationResult.getValidationMessages().size());
5858
List<String> contextValues = (List<String>) validationResult.getCollectorContext().get(SAMPLE_COLLECTOR);
59+
contextValues.sort(null);
5960
Assertions.assertEquals(0, validationResult.getValidationMessages().size());
6061
Assertions.assertEquals(2, contextValues.size());
6162
Assertions.assertEquals(contextValues.get(0), "actual_value_added_to_context1");

0 commit comments

Comments
 (0)