use of com.github.tomakehurst.wiremock.verification.FindRequestsResult in project wiremock by wiremock.
the class FindRequestsTask method execute.
@Override
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) {
RequestPattern requestPattern = Json.read(request.getBodyAsString(), RequestPattern.class);
FindRequestsResult result = admin.findRequestsMatching(requestPattern);
return responseDefinition().withStatus(HTTP_OK).withBody(Json.write(result)).withHeader("Content-Type", "application/json").build();
}
use of com.github.tomakehurst.wiremock.verification.FindRequestsResult in project chutney by chutney-testing.
the class HttpsListenerTask method execute.
@Override
public TaskExecutionResult execute() {
FindRequestsResult result = httpsServer.findRequestsMatching(RequestPatternBuilder.newRequestPattern(RequestMethod.fromString(verb), WireMock.urlMatching(uri)).build());
int requestReceived = result.getRequests().size();
if (requestReceived < expectedMessageCount) {
logger.error("Expected " + expectedMessageCount + " message(s). Receive only " + requestReceived + " message(s)");
return TaskExecutionResult.ko();
}
httpsServer.resetRequests();
return TaskExecutionResult.ok(toOutputs(result.getRequests()));
}
Aggregations