I'm trying to validate that a JSON array contains a certain value. Using Rest-Assured with a hamcrest matchers import in Java. This is the JSON that I'm validating;
{
"graph": {
"groupedResultColumns": [
"Task_Status",
"Task_TimeSpent"
]
}
}
After reading about rest assured and hamcrest matchers, this is the code that I am trying at the moment;
{
SerenityRest.then()
.body(containsString("groupedResultColumns"))
.assertThat().body("groupedResultColumns", (hasItems("Task_TimeSpent")));
}
This is the error I'm getting;
JSON path groupedResultColumns doesn't match.
Expected: (a collection containing "Task_TimeSpent")
Actual: null
Any help or advice is appreciated, Thanks!