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_and_return_new_one_with_different_configuration.
@Test
public void it_should_get_client_with_given_strategy_custom_configuration_and_return_new_one_with_different_configuration() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClientStrategy strategy = HttpClientStrategy.OK_HTTP3;
final HttpClientConfiguration configuration1 = new HttpClientConfiguration.Builder().disableFollowRedirect().build();
final HttpClientConfiguration configuration2 = new HttpClientConfiguration.Builder().build();
final HttpClient client1 = adapter.getClient(strategy, configuration1);
final HttpClient client2 = adapter.getClient(strategy, configuration2);
assertThat(client1).isNotSameAs(client2);
assertThat(client1).isInstanceOf(OkHttpClient.class);
assertThat(client2).isInstanceOf(OkHttpClient.class);
assertThat(client1.getConfiguration()).isSameAs(configuration1);
assertThat(client2.getConfiguration()).isSameAs(configuration2);
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_implement_to_string.
@Test
void it_should_implement_to_string() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
assertThat(adapter).hasToString("EmbeddedServerRunner{" + "server: MockEmbeddedServer, " + "clients: {}" + "}");
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_server_scheme.
@Test
void it_should_get_server_scheme() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final String scheme = adapter.getScheme();
assertThat(scheme).isNotNull().isEqualTo(server.getScheme());
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_check_if_server_is_started.
@Test
void it_should_check_if_server_is_started() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
adapter.start();
assertThat(adapter.isStarted()).isTrue();
adapter.stop();
assertThat(adapter.isStarted()).isFalse();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_start_server_before_test.
@Test
void it_should_start_server_before_test() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
adapter.beforeAll();
verify(server).start();
}
Aggregations