Skip to content

Commit

Permalink
enhance test
Browse files Browse the repository at this point in the history
  • Loading branch information
fslev committed Oct 3, 2022
1 parent 61fac34 commit 5133d76
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ public void compareNumbers() {

@Test
public void compareAll() {
String expected = "{\"a\":null,\"b\":1,\"c\":false,\"d\":\"false\",\"e\":\"text\"}";
String actual = "{\"a\":\"null\",\"b\":\"1\",\"c\":\"false\",\"d\":false,\"e\":false}";
String expected = "{\"a\":null,\"b\":1,\"c\":false,\"d\":\"false\",\"e\":\"text\",\"f\":13432.543,\"f1\":13432.543}";
String actual = "{\"a\":\"null\",\"b\":\"1\",\"c\":\"false\",\"d\":false,\"e\":false,\"f\":13432.543,\"f1\":\"13432.543\"}";
AssertionError error = assertThrows(AssertionError.class, () -> JSONCompare.assertMatches(expected, actual));
assertTrue(error.getMessage().matches("(?s).*FOUND 4 DIFFERENCE.*" +
assertTrue(error.getMessage().matches("(?s).*FOUND 5 DIFFERENCE.*" +
"a ->.*Expected null: But got: \"null\".*" +
"b ->.*Expected number: 1 But got: \"1\".*" +
"c ->.*Expected boolean: false But got: \"false\".*" +
"e ->.*Expected value: \"text\" But got: false.*"));
"e ->.*Expected value: \"text\" But got: false.*"+
"f1 ->.*Expected number: 13432.543 But got: \"13432.543\".*"));
JSONCompare.assertNotMatches(expected, actual);
}
}

0 comments on commit 5133d76

Please sign in to comment.