You can use the Hamcrest matcher hasKey() (from org.hamcrest.Matchers
class) on JSON strings as well.
when()
.get("/person/12345")
.then()
.body("$", hasKey("surname"))
.body("$", not(hasKey("age")));
You can use the Hamcrest matcher hasKey() (from org.hamcrest.Matchers
class) on JSON strings as well.
when()
.get("/person/12345")
.then()
.body("$", hasKey("surname"))
.body("$", not(hasKey("age")));