use of com.toomuchcoding.jsonassert.JsonVerifiable in project wiremock by wiremock.
the class AdminApiTest method getLoggedRequestsWithLimitAndSinceDate.
@Test
public void getLoggedRequestsWithLimitAndSinceDate() throws Exception {
for (int i = 1; i <= 5; i++) {
testClient.get("/received-request/" + i);
}
String midPoint = new ISO8601DateFormat().format(new Date());
for (int i = 6; i <= 9; i++) {
testClient.get("/received-request/" + i);
}
String body = testClient.get("/__admin/requests?since=" + midPoint + "&limit=3").content();
JsonVerifiable check = JsonAssertion.assertThat(body);
check.field("meta").field("total").isEqualTo(9);
check.field("requests").hasSize(3);
check.field("requests").elementWithIndex(0).field("request").field("url").isEqualTo("/received-request/9");
check.field("requests").elementWithIndex(2).field("request").field("url").isEqualTo("/received-request/7");
}
Aggregations