Skip to content

Commit

Permalink
relax expected
Browse files Browse the repository at this point in the history
  • Loading branch information
fslev committed Sep 18, 2022
1 parent 8ead4e1 commit 7cdaf4c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/test/java/io/jtest/utils/matcher/StringMatcherTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ public void compareStringWithAssignSymbolsAndSeparateRegexAgainstStringWithRegex
try {
new StringMatcher(null, expected, actual, null).match();
} catch (AssertionError | InvalidTypeException e) {
assertEquals("Strings do not match\n\nMatching is by default done using regular expressions.\n" +
"If expected object contains any unintentional regexes, then quote them between \\Q and \\E delimiters.\n" +
" ==> expected: <.* is regex ~[regex] [0-9]*> but was: <This is regex a|b|c|d [0-9]*>", e.getMessage());
assertTrue(e.getMessage().matches("(?s)Strings do not match\n\nMatching is by default done using regular expressions.\n" +
"If expected object contains any unintentional regexes, then quote them between \\\\Q and \\\\E delimiters.\n" +
".*expected.*\\Q<.* is regex ~[regex] [0-9]*>\\E.*\\Q<This is regex a|b|c|d [0-9]*>\\E.*"));
return;
}
fail("Values should not match ! But they do...");
Expand All @@ -253,11 +253,10 @@ public void compareStringWithAssignSymbolsAndRegexAgainstStringWithRegexCharacte
try {
new StringMatcher(null, expected, actual, null).match();
} catch (AssertionError | InvalidTypeException e) {
assertEquals("Strings do not match\n" +
"\n" +
assertTrue(e.getMessage().matches("(?s)Strings do not match\n\n" +
"Matching is by default done using regular expressions.\n" +
"If expected object contains any unintentional regexes, then quote them between \\Q and \\E delimiters.\n" +
" ==> expected: <.* is regex ~[regex]lorem> but was: <This is regex a|b|c|d>", e.getMessage());
"If expected object contains any unintentional regexes, then quote them between \\\\Q and \\\\E delimiters.\n" +
".*expected.*\\Q<.* is regex ~[regex]lorem>\\E.*\\Q<This is regex a|b|c|d>\\E.*"));
return;
}
fail("Values should not match ! But they do...");
Expand Down

0 comments on commit 7cdaf4c

Please sign in to comment.