From c72bf5c46be54ef80b3922a0d624c2affcdf3fb7 Mon Sep 17 00:00:00 2001 From: Alexander Ronald Altman Date: Sat, 4 Dec 2021 11:54:35 -0800 Subject: [PATCH] Ensure full array comparison test ignores order This test was failing under [NonDex](https://github.com/TestingResearchIllinois/NonDex) because it relied on a specific order of comparison results; this PR alters it to accept any order of the results so long as all the expected ones are present. (As a bonus, the regex now looks a bit cleaner.) --- .../skyscreamer/jsonassert/comparator/CustomComparatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/skyscreamer/jsonassert/comparator/CustomComparatorTest.java b/src/test/java/org/skyscreamer/jsonassert/comparator/CustomComparatorTest.java index 651e6a87..167fc534 100644 --- a/src/test/java/org/skyscreamer/jsonassert/comparator/CustomComparatorTest.java +++ b/src/test/java/org/skyscreamer/jsonassert/comparator/CustomComparatorTest.java @@ -48,6 +48,6 @@ public void testFullArrayComparison() throws Exception { Assert.assertTrue(compareResult.failed()); String message = compareResult.getMessage().replaceAll("\n", ""); - Assert.assertTrue(message, message.matches(".*id=5.*Expected.*id=6.*Unexpected.*id=7.*Unexpected.*")); + Assert.assertTrue(message, message.matches("(?:.*id=(?:5.*Expected|6.*Unexpected|7.*Unexpected)){3}.*")); } }