Skip to content
Permalink
Browse files
curly braces are special in Java Regex
Oro seems to get along with the escaped braces, so use them for testing
both implementations
  • Loading branch information
FSchumacher committed Mar 5, 2022
1 parent 9681192 commit 8da5aab2ac94afa2e99700e14f285d99bbfbf338
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -258,7 +258,7 @@ public void testResponseAssertionContainsDollar() throws Exception {
assertion.unsetNotType();
assertion.setToContainsType();
assertion.setTestFieldResponseData();
assertion.addTestString("value=\"\\${ID}\" Group\\$ctl00\\$drpEmails");
assertion.addTestString("value=\"\\$\\{ID\\}\" Group\\$ctl00\\$drpEmails");

result = assertion.getResult(sample);
assertPassed();
@@ -82,7 +82,7 @@ void testIsJsonValidationBool() {
"{\"myval\": 123}; $.myval; 123",
"{\"myval\": [{\"test\":1},{\"test\":2},{\"test\":3}]}; $.myval[*].test; 2",
"{\"myval\": []}; $.myval; []",
"{\"myval\": {\"key\": \"val\"}}; $.myval; {\"key\":\"val\"}"
"{\"myval\": {\"key\": \"val\"}}; $.myval; \\{\"key\":\"val\"\\}"
}, delimiterString=";")
void testGetResult_pathsWithOneResult(String data, String jsonPath, String expectedResult) {
SampleResult samplerResult = new SampleResult();
@@ -311,14 +311,14 @@ void testGetResult_match_msg_problem() {
instance.setJsonPath("$.execution[0].scenario.requests[0].headers");
instance.setJsonValidationBool(true);
instance.setExpectNull(false);
instance.setExpectedValue("{headerkey=header value}");
instance.setExpectedValue("\\{headerkey=header value\\}");
instance.setInvert(false);
AssertionResult expResult = new AssertionResult("");
AssertionResult result = instance.getResult(samplerResult);
assertEquals(expResult.getName(), result.getName());
assertTrue(result.isFailure());
assertEquals(
"Value expected to match regexp '{headerkey=header value}', but it did not match: '{\"headerkey\":\"header value\"}'",
"Value expected to match regexp '\\{headerkey=header value\\}', but it did not match: '{\"headerkey\":\"header value\"}'",
result.getFailureMessage());
}

0 comments on commit 8da5aab

Please sign in to comment.