use of com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfigurationBuilder in project junit-servers by mjeanroy.
the class ServersTest method it_should_instantiate_server_with_configuration.
@Test
void it_should_instantiate_server_with_configuration() {
final FakeEmbeddedServerConfiguration configuration = new FakeEmbeddedServerConfigurationBuilder().build();
final EmbeddedServer<?> server = Servers.instantiate(configuration);
assertThat(server).isNotNull().isExactlyInstanceOf(FakeEmbeddedServer.class);
assertThat(server.getConfiguration()).isNotNull().isSameAs(configuration);
}
use of com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfigurationBuilder in project junit-servers by mjeanroy.
the class AbstractEmbeddedServerTest method it_should_get_url_with_custom_path_pre_pending_slash.
@Test
void it_should_get_url_with_custom_path_pre_pending_slash() {
final FakeEmbeddedServer server = new FakeEmbeddedServer(new FakeEmbeddedServerConfigurationBuilder().withPath("foo").build());
assertThat(server.getUrl()).isEqualTo(localUrl(0, "/foo"));
}
use of com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfigurationBuilder in project junit-servers by mjeanroy.
the class AbstractEmbeddedServerTest method it_should_execute_hook.
@Test
void it_should_execute_hook() {
final Hook hook = mock(Hook.class);
final FakeEmbeddedServerConfiguration configuration = new FakeEmbeddedServerConfigurationBuilder().withHook(hook).build();
server = new FakeEmbeddedServer(configuration);
server.start();
verify(hook).pre(server);
verify(hook).onStarted(server, server.getServletContext());
verify(hook, never()).post(server);
server.stop();
verify(hook).post(server);
verify(hook, times(1)).pre(server);
verify(hook, times(1)).pre(server);
}
use of com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfigurationBuilder in project junit-servers by mjeanroy.
the class AbstractEmbeddedServerTest method it_should_get_url_and_do_not_encode_custom_path.
@Test
void it_should_get_url_and_do_not_encode_custom_path() {
final FakeEmbeddedServerConfiguration configuration = new FakeEmbeddedServerConfigurationBuilder().withPath("/foo bar").build();
final FakeEmbeddedServer server = new FakeEmbeddedServer(configuration);
final String url = server.getUrl();
assertThat(url).isEqualTo(localUrl(server.getPort(), "/foo bar"));
}
use of com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfigurationBuilder in project junit-servers by mjeanroy.
the class AbstractEmbeddedServerTest method it_should_get_custom_path.
@Test
void it_should_get_custom_path() {
final FakeEmbeddedServer server = new FakeEmbeddedServer(new FakeEmbeddedServerConfigurationBuilder().withPath("/foo").build());
assertThat(server.getPath()).isEqualTo("/foo");
}
Aggregations