use of com.github.mjeanroy.junit.servers.client.HttpClient in project junit-servers by mjeanroy.
the class BaseHttpClientTest method it_should_create_delete_request.
@Test
void it_should_create_delete_request() {
final HttpClient client = createDefaultClient(server);
final HttpRequest httpRequest = client.prepareDelete("/foo");
assertThat(httpRequest.getMethod()).isEqualTo(HttpMethod.DELETE);
}
use of com.github.mjeanroy.junit.servers.client.HttpClient in project junit-servers by mjeanroy.
the class BaseHttpClientTest method it_should_create_client_with_custom_configuration.
@Test
void it_should_create_client_with_custom_configuration() {
final HttpClientConfiguration configuration = new HttpClientConfiguration.Builder().disableFollowRedirect().build();
final HttpClient client = createCustomClient(configuration, server);
assertThat(client).isNotNull();
final EmbeddedServer<?> server = readPrivate(client, "server");
assertThat(server).isNotNull().isSameAs(this.server);
checkInternalHttpClient(configuration, client);
}
use of com.github.mjeanroy.junit.servers.client.HttpClient in project junit-servers by mjeanroy.
the class BaseHttpClientTest method it_should_create_put_request.
@Test
void it_should_create_put_request() {
final HttpClient client = createDefaultClient(server);
final HttpRequest httpRequest = client.preparePut("/foo");
assertThat(httpRequest.getMethod()).isEqualTo(HttpMethod.PUT);
}
use of com.github.mjeanroy.junit.servers.client.HttpClient in project junit-servers by mjeanroy.
the class BaseHttpClientTest method it_should_create_request.
@Test
void it_should_create_request() {
final HttpClient client = createDefaultClient(server);
final String endpoint = "/foo";
final HttpMethod httpMethod = HttpMethod.POST;
final HttpRequest httpRequest = client.prepareRequest(httpMethod, endpoint);
assertThat(httpRequest.getMethod()).isEqualTo(httpMethod);
assertThat(httpRequest.getEndpoint()).isNotNull();
assertThat(httpRequest.getEndpoint().getScheme()).isEqualTo(scheme);
assertThat(httpRequest.getEndpoint().getHost()).isEqualTo(host);
assertThat(httpRequest.getEndpoint().getPort()).isEqualTo(port);
assertThat(httpRequest.getEndpoint().getPath()).isEqualTo(path + endpoint);
assertThat(httpRequest.getEndpoint().toString()).isEqualTo(url(scheme, host, port, path + endpoint));
}
use of com.github.mjeanroy.junit.servers.client.HttpClient in project junit-servers by mjeanroy.
the class BaseHttpClientTest method it_should_create_default_client.
@Test
void it_should_create_default_client() {
final HttpClient client = createDefaultClient(server);
assertThat(client).isNotNull();
final EmbeddedServer<?> internalServer = readPrivate(client, "server");
assertThat(internalServer).isSameAs(server);
checkInternalHttpClient(client);
}
Aggregations