use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JunitServerExtensionTest method it_should_initialize_extension_with_given_server_and_start_given_server_before_all_tests.
@Test
void it_should_initialize_extension_with_given_server_and_start_given_server_before_all_tests() {
final EmbeddedServer<?> server = new EmbeddedServerMockBuilder().build();
final JunitServerExtension extension = new JunitServerExtension(server);
final FixtureClass testInstance = new FixtureClass();
final FakeExtensionContext context = new FakeExtensionContext(testInstance);
extension.beforeAll(context);
final FakeStore store = context.getSingleStore();
final EmbeddedServerRunner serverAdapter = store.get("serverAdapter", EmbeddedServerRunner.class);
assertThat(serverAdapter).isNotNull();
assertThat(serverAdapter.getServer()).isSameAs(server);
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JunitServerExtensionTest method it_should_stop_server_after_all_tests.
@Test
void it_should_stop_server_after_all_tests() {
final JunitServerExtension extension = new JunitServerExtension();
final FixtureClass testInstance = new FixtureClass();
final FakeExtensionContext context = new FakeExtensionContext(testInstance);
extension.beforeAll(context);
final FakeStore store = context.getSingleStore();
final EmbeddedServerRunner serverAdapter = store.get("serverAdapter", EmbeddedServerRunner.class);
extension.afterAll(context);
assertThat(store.isEmpty()).isTrue();
assertThat(serverAdapter.getServer().isStarted()).isFalse();
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JettyServerExtensionTest method it_should_start_given_jetty_server_before_all_tests.
@Test
void it_should_start_given_jetty_server_before_all_tests() {
final EmbeddedJetty jetty = new EmbeddedJettyMockBuilder().build();
final JettyServerExtension extension = new JettyServerExtension(jetty);
final FixtureClass testInstance = new FixtureClass();
final FakeExtensionContext context = new FakeExtensionContext(testInstance);
extension.beforeAll(context);
final FakeStore store = context.getSingleStore();
final EmbeddedServerRunner serverAdapter = store.get("serverAdapter", EmbeddedServerRunner.class);
assertThat(serverAdapter).isNotNull();
assertThat(serverAdapter.getServer()).isSameAs(jetty);
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
Aggregations