Given an API response as:
{
"res": [
{
"id": 1,
"name": "a",
},
{
"id": 2,
"name": "b",
}
]
}
How can I assert using hamcrest matcher that name field for object with id 1 is a.
CodePudding user response:
It would be
given()...
.then()
.body("res.find {it.id == 1}.name", equalTo("a"));