I am using rest-assured to test a rest api. I have a json response that returns an array of objects. I want verify that it contains objects with specific test of values. Check the following example:
Example JSON:
{
"contents" : [
{
"field1" : "value1",
"field2" : "value2"
},
{
"field1" : "value3",
"field2" : "value4"
}
]
}
How do I write the body assertion so that I can check that regardless of the position I have one entry with:
value1 & value2 in each respective field and another entry with value3 & value4.
...get ("/myEndpoint" )
.then()
.body ( "contents.?????", contains...)