Im new to TestNG and I'm trying to test if the respone body has data. Right now, the JSON body gives back these datas, if I run the http://localhost:8080/sportsbetting-web/loadEvents on POSTMAN.
[ {
"id": 2,
"title": "Fradi vs UTE",
"type": "Football Match",
"start": [
2022,
5,
29,
8,
47,
54,
383000000
],
"end": [
2022,
5,
29,
10,
47,
54,
383000000
]
}, ... ]
Now I should test the same http://localhost:8080/sportsbetting-web/loadEvents API endpoint with TestNG, but how should I do it? I tried this:
@Test
public void testGetEvents(){
given().when().get("http://localhost:8080/sportsbetting-web/loadEvents").then().statusCode(200);
}
It gives back 200 OK response, however I would like to test if the response body contains JSON data, such as id, title
