use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class HttpClientParameterResolverFunctionTest method setUp.
@BeforeEach
void setUp() {
resolver = HttpClientParameterResolverFunction.getInstance();
adapter = new EmbeddedServerRunner(new EmbeddedServerMockBuilder().build());
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JettyServerExtensionTest method it_should_start_server_with_default_configuration_before_all_tests.
@Test
void it_should_start_server_with_default_configuration_before_all_tests() {
final JettyServerExtension extension = new JettyServerExtension();
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()).isNotNull().isExactlyInstanceOf(EmbeddedJetty.class);
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JettyServerExtensionTest method it_should_start_jetty_server_using_given_configuration_before_all_tests.
@Test
void it_should_start_jetty_server_using_given_configuration_before_all_tests() {
final EmbeddedJettyConfiguration configuration = EmbeddedJettyConfiguration.defaultConfiguration();
final JettyServerExtension extension = new JettyServerExtension(configuration);
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()).isNotNull().isExactlyInstanceOf(EmbeddedJetty.class);
assertThat(serverAdapter.getServer().getConfiguration()).isSameAs(configuration);
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_inject_annotated_field_before_each_test.
@Test
void it_should_inject_annotated_field_before_each_test() {
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.beforeEach(context);
final AnnotationsHandlerRunner annotationsAdapter = store.get("annotationsAdapter", AnnotationsHandlerRunner.class);
assertThat(annotationsAdapter).isNotNull();
assertThat(testInstance.server).isNotNull().isSameAs(serverAdapter.getServer());
assertThat(testInstance.configuration).isNotNull().isSameAs(serverAdapter.getServer().getConfiguration());
assertThat(testInstance.client).isNotNull();
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class TomcatServerExtensionTest method it_should_start_given_tomcat_server_before_all_tests.
@Test
void it_should_start_given_tomcat_server_before_all_tests() {
final EmbeddedTomcat tomcat = new EmbeddedTomcatMockBuilder().build();
final TomcatServerExtension extension = new TomcatServerExtension(tomcat);
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(tomcat);
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
Aggregations