use of com.github.tomakehurst.wiremock.verification.VerificationResult in project furms by unity-idm.
the class UnityClientTest method shouldSend_DELETE_toUnityServer.
@Test
void shouldSend_DELETE_toUnityServer() {
// given
RequestPattern request = new RequestPatternBuilder(DELETE, new UrlPattern(new EqualToPattern("/path/to/unity/test?recursive=true"), false)).build();
server.addStubMapping(new StubMapping(request, ResponseDefinitionBuilder.responseDefinition().withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE).withStatus(SC_OK).build()));
// when
unityClient.delete("/path/to/unity/test", Map.of("recursive", TRUE.toString()));
// then
VerificationResult verificationResult = server.countRequestsMatching(request);
assertThat(verificationResult.getCount()).isEqualTo(1);
}
use of com.github.tomakehurst.wiremock.verification.VerificationResult in project furms by unity-idm.
the class UnityClientTest method shouldSend_GET_toUnityServer.
@Test
void shouldSend_GET_toUnityServer() {
// given
RequestPattern request = new RequestPatternBuilder(GET, new UrlPattern(new EqualToPattern("/path/to/unity/test?param1=stringValue¶m2=1"), false)).build();
server.addStubMapping(new StubMapping(request, ResponseDefinitionBuilder.responseDefinition().withBody("{\"field\": \"string_value\"}").withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE).withStatus(SC_OK).build()));
// when
SampleDto response = unityClient.get("/path/to/unity/test", SampleDto.class, Map.of("param1", "stringValue", "param2", "1"));
// then
VerificationResult verificationResult = server.countRequestsMatching(request);
assertThat(verificationResult.getCount()).isEqualTo(1);
assertThat(response.getField()).isEqualTo("string_value");
}
use of com.github.tomakehurst.wiremock.verification.VerificationResult in project ccd-data-store-api by hmcts.
the class ReferenceDataCacheRefreshIT method verifyWiremockInvocation.
private void verifyWiremockInvocation(final String path, final int count) {
final RequestPattern requestPattern = getRequestedFor(urlPathEqualTo(path)).build();
final VerificationResult verificationResult = wireMockServer.countRequestsMatching(requestPattern);
assertThat(verificationResult).isNotNull().satisfies(result -> assertThat(result.getCount()).isGreaterThanOrEqualTo(count));
}
use of com.github.tomakehurst.wiremock.verification.VerificationResult in project wiremock by wiremock.
the class GetRequestCountTask method execute.
@Override
public ResponseDefinition execute(Admin admin, Request request, PathParams pathParams) {
RequestPattern requestPattern = Json.read(request.getBodyAsString(), RequestPattern.class);
VerificationResult result = admin.countRequestsMatching(requestPattern);
return responseDefinition().withStatus(HTTP_OK).withBody(write(result)).withHeader("Content-Type", "application/json").build();
}
use of com.github.tomakehurst.wiremock.verification.VerificationResult in project wiremock by wiremock.
the class StubMappingJsonRecorder method requestNotAlreadyReceived.
private boolean requestNotAlreadyReceived(RequestPattern requestPattern) {
VerificationResult verificationResult = admin.countRequestsMatching(requestPattern);
verificationResult.assertRequestJournalEnabled();
return (verificationResult.getCount() < 1);
}
Aggregations