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_custom_configuration_and_return_previous_one_with_same_configuration.
@Test
public void it_should_get_client_with_custom_configuration_and_return_previous_one_with_same_configuration() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClientConfiguration configuration1 = new HttpClientConfiguration.Builder().build();
final HttpClientConfiguration configuration2 = new HttpClientConfiguration.Builder().build();
final HttpClient client1 = adapter.getClient(configuration1);
final HttpClient client2 = adapter.getClient(configuration2);
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_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.utils.builders.EmbeddedServerMockBuilder 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();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class EmbeddedServerRunnerTest method it_should_get_client.
@Test
void it_should_get_client() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final EmbeddedServerRunner adapter = new EmbeddedServerRunner(server);
final HttpClient client = adapter.getClient();
assertThat(client).isNotNull();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class AnnotationsHandlerRuleTest method it_should_implement_to_string.
@Test
void it_should_implement_to_string() {
final AbstractConfiguration configuration = new AbstractConfigurationMockBuilder().build();
final EmbeddedServer<?> embeddedServer = new EmbeddedServerMockBuilder().build();
final FixtureClass target = new FixtureClass();
final AnnotationsHandlerRule rule = new AnnotationsHandlerRule(target, embeddedServer, configuration);
assertThat(rule).hasToString("AnnotationsHandlerRule{" + "target: FixtureClass, " + "annotationHandlers: AnnotationsHandlerRunner{" + "handlers: [" + "ServerAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestServer, " + "server: MockEmbeddedServer" + "}, " + "ConfigurationAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestServerConfiguration, " + "configuration: MockAbstractConfiguration" + "}, " + "HttpClientAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestHttpClient, " + "server: MockEmbeddedServer" + "}" + "]" + "}" + "}");
}
Aggregations