I need to get the size of the "description" array, convert to object dto. I need to check with rest assured if my array "description" contains at least 1 element inside. How do I do that? My Json
{
"success": true,
"description": [
{
"a": "xxx",
"a": 5,
"a": "xxx",
"a": "xx",
"aaa": [
{
"b": 247,
"b": "BR",
"b": "CPF",
"b": 3
}
],
"ccc": 3
}
]
}
My code
public class Name extends Base {
private final String UrlString= "resource";
@Test
public void teste() {
ResponseDTO responseDTO = given()
.contentType(ContentType.JSON)
.headers("utoken", utoken)
.pathParam("name",name)
.when()
.get(UrlString)
.then()
.statusCode(is(statusok))
.extract().as(ResponseDTO.class);
validade(responseDTO);
}
public void validade(ResponseDTO responseDTO) {
assertTrue(responseDTO.isSuccess());
}
My DTO
public class ResponseDTO {
private boolean success;
private List description;
getters/setters
}