@ Hector
[ {"id" : 4, "name" : "Name4"}, {"id" : 5, "name" : "Name5"} ]
This was a really bad example. Here you have the matrix [2,2].
If you create something like this:
[ {"id" : 4, "name" : "Name4"}, {"id" : 5, "name" : "Name5"}, {"id" : 6, "name" : "Name6"} ]
Now you will still pass the test:
@Test public void test() { RestAssured.get("/foos").then().assertThat() .body("size()", is(2)); }
Think about whether it was intentional. body("size()",is(2)); represents body("size()",is(2)); Have a check on the length of one node instead of the number of records in the response.
source share