Following is Response body:
{
"Updated_Fields": [
"a",
"b",
"c",
"d"
],
"Invalid_Fields": [
"cd",
"ab"
]
}
I want to check that whether response body has
- two fields in invalid_field block
- 'cd' and 'ab' should be there in invalid_field block
JSONArray JSONResponseBody = new JSONArray(response.body().asString());
Assert.assertEquals(JSONResponseBody.getJSONObject(0).getString("Invalid_Fields"), "cd");
response.jsonPath().param("Invalid_Fields", "cd");
assertThat( response.asString(), hasJsonPath("Invalid_Fields.ab"));
Getting an error