use of org.mockserver.log.MockServerEventLog in project mockserver by mock-server.
the class HttpStateTest method shouldVerifySequenceFailureWithCallback.
@Test
public void shouldVerifySequenceFailureWithCallback() throws Exception {
// given
MockServerEventLog mockServerEventLog = httpState.getMockServerLog();
mockServerEventLog.add(new LogEntry().setHttpRequest(request("one")).setType(RECEIVED_REQUEST));
mockServerEventLog.add(new LogEntry().setHttpRequest(request("two")).setType(RECEIVED_REQUEST));
mockServerEventLog.add(new LogEntry().setHttpRequest(request("three")).setType(RECEIVED_REQUEST));
CompletableFuture<String> verificationResult = new CompletableFuture<>();
// when
httpState.verify(new VerificationSequence().withRequests(request("three"), request("one")), verificationResult::complete);
// then
assertThat(verificationResult.get(5, SECONDS), is("Request sequence not found, expected:<[ {" + NEW_LINE + " \"path\" : \"three\"" + NEW_LINE + "}, {" + NEW_LINE + " \"path\" : \"one\"" + NEW_LINE + "} ]> but was:<[ {" + NEW_LINE + " \"path\" : \"one\"" + NEW_LINE + "}, {" + NEW_LINE + " \"path\" : \"two\"" + NEW_LINE + "}, {" + NEW_LINE + " \"path\" : \"three\"" + NEW_LINE + "} ]>"));
}
Aggregations