use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.
the class ConfigurationAnnotationHandlerTest method it_should_support_server_annotation.
@Test
void it_should_support_server_annotation() {
final AbstractConfiguration configuration = new AbstractConfigurationMockBuilder().build();
final AnnotationHandler handler = newConfigurationAnnotationHandler(configuration);
final Field field = extractConfigurationField();
final Annotation annotation = readAnnotation(field);
assertThat(handler.support(annotation)).isTrue();
}
use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration 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.servers.AbstractConfiguration in project junit-servers by mjeanroy.
the class ServersTest method it_should_return_null_without_configuration_field.
@Test
void it_should_return_null_without_configuration_field() {
final AbstractConfiguration configuration = Servers.findConfiguration(FixtureClass.class);
assertThat(configuration).isNull();
}
use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.
the class AnnotationsHandlerRuleTest method it_should_implement_to_string.
@Test
void it_should_implement_to_string() {
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);
assertThat(rule).hasToString("AnnotationsHandlerRule{" + "target: FixtureClass, " + "annotationHandlers: AnnotationsHandlerRunner{" + "handlers: [" + "ServerAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestServer, " + "server: MockEmbeddedServer" + "}, " + "ConfigurationAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestServerConfiguration, " + "configuration: MockAbstractConfiguration" + "}, " + "HttpClientAnnotationHandler{" + "annotationKlass: interface com.github.mjeanroy.junit.servers.annotations.TestHttpClient, " + "server: MockEmbeddedServer" + "}" + "]" + "}" + "}");
}
use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration 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);
}
Aggregations