use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_start_server.
@Test
void it_should_start_server() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
adapter.start();
verify(server).start();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_client_and_returns_previous_one.
@Test
void it_should_get_client_and_returns_previous_one() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClient client1 = adapter.getClient();
final HttpClient client2 = adapter.getClient();
assertThat(client1).isNotNull();
assertThat(client2).isNotNull();
assertThat(client1).isSameAs(client2);
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_stop_server_and_close_clients.
@Test
void it_should_stop_server_and_close_clients() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClient client = adapter.getClient();
assertThat(client).isNotNull();
assertThat(client.isDestroyed()).isFalse();
adapter.stop();
assertThat(client).isNotNull();
assertThat(client.isDestroyed()).isTrue();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder 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.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_stop_server.
@Test
void it_should_stop_server() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
adapter.stop();
verify(server).stop();
}
Aggregations