use of com.github.tomakehurst.wiremock.verification.VerificationResult in project furms by unity-idm.
the class UnityClientTest method shouldSend_POST_toUnityServer.
@Test
void shouldSend_POST_toUnityServer() {
// given
RequestPattern request = new RequestPatternBuilder(POST, new UrlPattern(new EqualToPattern("/path/to/unity/test"), false)).build();
server.addStubMapping(new StubMapping(request, ResponseDefinitionBuilder.responseDefinition().withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE).withBody("{\"field\": \"string\"}").withStatus(SC_OK).build()));
// when
unityClient.post("/path/to/unity/test", new SampleDto("string"));
// 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_PUT_toUnityServer.
@Test
void shouldSend_PUT_toUnityServer() {
// given
RequestPattern request = new RequestPatternBuilder(PUT, new UrlPattern(new EqualToPattern("/path/to/unity/test"), false)).build();
server.addStubMapping(new StubMapping(request, ResponseDefinitionBuilder.responseDefinition().withHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE).withBody("{\"field\": \"string\"}").withStatus(SC_OK).build()));
// when
unityClient.put("/path/to/unity/test", Map.of("param", "test"));
// then
VerificationResult verificationResult = server.countRequestsMatching(request);
assertThat(verificationResult.getCount()).isEqualTo(1);
}
Aggregations