use of com.github.mjeanroy.junit.servers.client.HttpClientStrategy in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_client_with_given_strategy_custom_configuration.
@Test
public void it_should_get_client_with_given_strategy_custom_configuration() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClientStrategy strategy = HttpClientStrategy.OK_HTTP3;
final HttpClientConfiguration configuration = new HttpClientConfiguration.Builder().disableFollowRedirect().build();
final HttpClient client = adapter.getClient(strategy, configuration);
assertThat(client).isInstanceOf(OkHttpClient.class);
assertThat(client.getConfiguration()).isSameAs(configuration);
}
use of com.github.mjeanroy.junit.servers.client.HttpClientStrategy in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_client_of_given_strategy_and_returns_previous_one.
@Test
void it_should_get_client_of_given_strategy_and_returns_previous_one() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClientStrategy strategy = HttpClientStrategy.OK_HTTP3;
final HttpClient client1 = adapter.getClient(strategy);
final HttpClient client2 = adapter.getClient(strategy);
assertThat(client1).isNotNull();
assertThat(client2).isNotNull();
assertThat(client1).isSameAs(client2);
}
use of com.github.mjeanroy.junit.servers.client.HttpClientStrategy in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_client_of_given_strategy_and_destroy_it_when_server_stop.
@Test
void it_should_get_client_of_given_strategy_and_destroy_it_when_server_stop() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClientStrategy strategy = HttpClientStrategy.OK_HTTP3;
final HttpClient client = adapter.getClient(strategy);
assertThat(client).isNotNull();
assertThat(client.isDestroyed()).isFalse();
adapter.stop();
assertThat(client).isNotNull();
assertThat(client.isDestroyed()).isTrue();
}
Aggregations