use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class AnnotationsHandlerRuleTest method it_should_process_handlers.
@Test
void it_should_process_handlers() {
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);
verifyBeforeTest(configuration, embeddedServer, target, rule);
verifyAfterTest(configuration, embeddedServer, target, rule);
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class ServerRuleTest method it_should_get_server_url.
@Test
void it_should_get_server_url() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().withScheme("http").withHost("localhost").withPort(8080).withPath("/").build();
final ServerRule rule = createRule(server);
final String result = rule.getUrl();
assertThat(result).isEqualTo("http://localhost:8080/");
verify(server).getUrl();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class ServerRuleTest method it_should_restart_server.
@Test
void it_should_restart_server() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final ServerRule rule = createRule(server);
rule.restart();
verify(server).restart();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class ServerRuleTest method it_should_get_new_http_client_if_it_has_been_destroyed.
@Test
void it_should_get_new_http_client_if_it_has_been_destroyed() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final ServerRule rule = createRule(server);
final HttpClient client = rule.getClient();
assertThat(client).isNotNull();
assertThat(client).isSameAs(rule.getClient());
assertThat(client.isDestroyed()).isFalse();
client.destroy();
final HttpClient newClient = rule.getClient();
assertThat(newClient).isNotNull();
assertThat(newClient).isNotSameAs(client);
assertThat(newClient.isDestroyed()).isFalse();
}
use of com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder in project junit-servers by mjeanroy.
the class ServerRuleTest method it_should_check_if_server_is_started.
@Test
void it_should_check_if_server_is_started() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final ServerRule rule = createRule(server);
assertThat(rule.isStarted()).isFalse();
rule.start();
assertThat(rule.isStarted()).isTrue();
verify(server, times(2)).isStarted();
}
Aggregations