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_configuration_and_start_given_server_before_all_tests.
@Test
void it_should_initialize_extension_with_given_configuration_and_start_given_server_before_all_tests() {
final AbstractConfiguration configuration = new FakeEmbeddedServerConfiguration();
final JunitServerExtension extension = new JunitServerExtension(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().isInstanceOf(FakeEmbeddedServer.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_start_server_before_all_tests.
@Test
void it_should_start_server_before_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);
assertThat(serverAdapter).isNotNull();
assertThat(serverAdapter.getServer()).isNotNull();
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class ConfigurationParameterResolverFunctionTest method setUp.
@BeforeEach
void setUp() {
resolver = ConfigurationResolverFunction.getInstance();
server = new EmbeddedServerMockBuilder().build();
adapter = new EmbeddedServerRunner(server);
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class EmbeddedServerParameterResolverFunctionTest method setUp.
@BeforeEach
void setUp() {
resolver = EmbeddedServerParameterResolverFunction.getInstance();
server = new EmbeddedServerMockBuilder().build();
adapter = new EmbeddedServerRunner(server);
}
use of com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner in project junit-servers by mjeanroy.
the class JunitServerExtensionTest method it_should_resolve_configuration_parameter.
@Test
void it_should_resolve_configuration_parameter() throws Exception {
final FixtureClass testInstance = new FixtureClass();
final FakeExtensionContext context = new FakeExtensionContext(testInstance);
final JunitServerExtension extension = initializeExtension(context);
final FakeStore store = context.getSingleStore();
final EmbeddedServerRunner serverAdapter = store.get("serverAdapter", EmbeddedServerRunner.class);
final ParameterContext parameterContext = createParameterContext("method_configuration", AbstractConfiguration.class);
final Object result = extension.resolveParameter(parameterContext, context);
assertThat(result).isNotNull().isSameAs(serverAdapter.getServer().getConfiguration());
}
Aggregations