Rest-assured. Expect array element with more then one property value defined

rest-assured

Solution

You can do like this:

get("/data").then().body("data.find { it.id == 1 }.active", is(true));

Problem

For example we have JSON in our response: `{"data":[{"id":1,"active":false},{"id":2,"active":true}]}` By using `expect().body("data", hasItem(hasEntry("id", 1)))` we can check, if 'data' array holds element with id=1. But how we can check, if 'data' array holds element with id=1 that is 'active' (id=1 && active=true)?

Original source