use of com.github.mjeanroy.junit.servers.utils.commons.Pair in project junit-servers by mjeanroy.
the class BaseHttpClientTest method testPreparePutWithBody.
@Test
void testPreparePutWithBody() {
final String endpoint = ENDPOINT + "/1";
final int status = 204;
final Collection<Pair> headers = emptyList();
final String body = "{\"id\": 1, \"name\": \"Jane Doe\"}";
stubPutRequest(endpoint, status, headers);
final HttpResponse rsp = createDefaultClient().preparePut(endpoint, jsonBody(body)).execute();
assertRequest(endpoint, HttpMethod.PUT);
assertThat(rsp.status()).isEqualTo(status);
assertThat(rsp.body()).isEmpty();
assertThat(rsp.getContentType()).isNull();
}
use of com.github.mjeanroy.junit.servers.utils.commons.Pair in project junit-servers by mjeanroy.
the class BaseHttpClientTest method testPreparePatchWithBody.
@Test
void testPreparePatchWithBody() {
final String endpoint = ENDPOINT + "/1";
final int status = 204;
final Collection<Pair> headers = emptyList();
final String body = "{\"id\": 1, \"name\": \"Jane Doe\"}";
stubPatchRequest(endpoint, status, headers, body);
final HttpResponse rsp = createDefaultClient().preparePatch(endpoint, jsonBody(body)).execute();
assertRequest(endpoint, HttpMethod.PATCH);
assertThat(rsp.status()).isEqualTo(status);
assertThat(rsp.body()).isEmpty();
}
Aggregations