|
34 | 34 | import static org.hamcrest.CoreMatchers.containsString;
|
35 | 35 | import static org.hamcrest.CoreMatchers.is;
|
36 | 36 | import static org.hamcrest.CoreMatchers.not;
|
| 37 | +import static org.jsmart.zerocode.core.utils.HelperJsonUtils.readJsonPath; |
37 | 38 | import static org.jsmart.zerocode.core.utils.SmartUtils.checkDigNeeded;
|
38 | 39 | import static org.jsmart.zerocode.core.utils.SmartUtils.readJsonAsString;
|
39 | 40 | import static org.jsmart.zerocode.core.utils.TokenUtils.getTestCaseTokens;
|
@@ -85,8 +86,8 @@ public void willResolveWithParamMap() throws Exception {
|
85 | 86 | final String resolvedRequestJson =
|
86 | 87 | jsonPreProcessor.resolveStringJson(requestJsonAsString, requestJsonAsString);
|
87 | 88 |
|
88 |
| - String lastName = JsonPath.read(resolvedRequestJson, "$.body.Customer.lastName"); |
89 |
| - String nickName = JsonPath.read(resolvedRequestJson, "$.body.Customer.nickName"); |
| 89 | + String lastName = readJsonPath(resolvedRequestJson, "$.body.Customer.lastName", String.class); |
| 90 | + String nickName = readJsonPath(resolvedRequestJson, "$.body.Customer.nickName", String.class); |
90 | 91 |
|
91 | 92 | assertNotEquals(lastName, nickName);
|
92 | 93 | }
|
@@ -1492,7 +1493,7 @@ public void test_JSONCONTENT_leafNode() throws IOException {
|
1492 | 1493 |
|
1493 | 1494 | String jsonResult = mapper.writeValueAsString(map);
|
1494 | 1495 |
|
1495 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.addressId"), is(39001)); |
| 1496 | + assertThat(readJsonPath(jsonResult, "$.request.body.addressId", Integer.class), is(39001)); |
1496 | 1497 | }
|
1497 | 1498 |
|
1498 | 1499 |
|
@@ -1556,11 +1557,11 @@ public void test_JSONCONTENT_objectArray() throws IOException {
|
1556 | 1557 |
|
1557 | 1558 | String jsonResult = mapper.writeValueAsString(map);
|
1558 | 1559 |
|
1559 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.allAddresses[0].id"), is(47)); |
1560 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.allAddresses[0].type"), is("Home")); |
1561 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.allAddresses[1].type"), is("Office")); |
1562 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.allAddresses[0].line1"), is("North Lon")); |
1563 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.allAddresses[1].line1"), is("Central Lon")); |
| 1560 | + assertThat(readJsonPath(jsonResult, "$.request.body.allAddresses[0].id", Integer.class), is(47)); |
| 1561 | + assertThat(readJsonPath(jsonResult, "$.request.body.allAddresses[0].type", String.class), is("Home")); |
| 1562 | + assertThat(readJsonPath(jsonResult, "$.request.body.allAddresses[1].type", String.class), is("Office")); |
| 1563 | + assertThat(readJsonPath(jsonResult, "$.request.body.allAddresses[0].line1", String.class), is("North Lon")); |
| 1564 | + assertThat(readJsonPath(jsonResult, "$.request.body.allAddresses[1].line1", String.class), is("Central Lon")); |
1564 | 1565 | }
|
1565 | 1566 |
|
1566 | 1567 | @Test
|
@@ -1588,8 +1589,8 @@ public void test_JSONCONTENT_jsonBlock() throws IOException {
|
1588 | 1589 |
|
1589 | 1590 | String jsonResult = mapper.writeValueAsString(map);
|
1590 | 1591 |
|
1591 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.address.type"), is("Home")); |
1592 |
| - assertThat(JsonPath.read(jsonResult, "$.request.body.address.line1"), is("River Side")); |
| 1592 | + assertThat(readJsonPath(jsonResult, "$.request.body.address.type", String.class), is("Home")); |
| 1593 | + assertThat(readJsonPath(jsonResult, "$.request.body.address.line1", String.class), is("River Side")); |
1593 | 1594 | }
|
1594 | 1595 |
|
1595 | 1596 | @Test
|
|
0 commit comments