Search in sources :

Example 16 with AbstractConfiguration

use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.

the class AnnotationsHandlerRunnerTest 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 AnnotationsHandlerRunner adapter = new AnnotationsHandlerRunner(embeddedServer, configuration);
    assertThat(adapter).hasToString("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" + "}" + "]" + "}");
}
Also used : AbstractConfiguration(com.github.mjeanroy.junit.servers.servers.AbstractConfiguration) AbstractConfigurationMockBuilder(com.github.mjeanroy.junit.servers.utils.builders.AbstractConfigurationMockBuilder) EmbeddedServerMockBuilder(com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder) Test(org.junit.jupiter.api.Test)

Example 17 with AbstractConfiguration

use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.

the class JunitServerRunnerTest method it_should_instantiate_jetty_with_default_configuration.

@Test
void it_should_instantiate_jetty_with_default_configuration() throws Exception {
    final JunitServerRunner runner = new JunitServerRunner(TestClassWithInjectedConfiguration.class);
    final EmbeddedServer<?> server = (EmbeddedServer<?>) readField(runner, "server", true);
    final AbstractConfiguration conf = (AbstractConfiguration) readField(runner, "configuration", true);
    assertThat(server).isInstanceOf(EmbeddedJetty.class);
    assertThat(conf).isNotSameAs(configuration).isEqualTo(configuration);
}
Also used : AbstractConfiguration(com.github.mjeanroy.junit.servers.servers.AbstractConfiguration) EmbeddedServer(com.github.mjeanroy.junit.servers.servers.EmbeddedServer) Test(org.junit.jupiter.api.Test)

Example 18 with AbstractConfiguration

use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.

the class JunitServerRunnerTest method it_should_instantiate_tomcat_with_default_configuration.

@Test
void it_should_instantiate_tomcat_with_default_configuration() throws Exception {
    final JunitServerRunner runner = new JunitServerRunner(TestClassWithInjectedConfiguration.class);
    final EmbeddedServer<?> server = (EmbeddedServer<?>) readField(runner, "server", true);
    final AbstractConfiguration conf = (AbstractConfiguration) readField(runner, "configuration", true);
    assertThat(server).isInstanceOf(EmbeddedTomcat.class);
    assertThat(conf).isNotSameAs(configuration).isEqualTo(configuration);
}
Also used : AbstractConfiguration(com.github.mjeanroy.junit.servers.servers.AbstractConfiguration) EmbeddedServer(com.github.mjeanroy.junit.servers.servers.EmbeddedServer) Test(org.junit.jupiter.api.Test)

Example 19 with AbstractConfiguration

use of com.github.mjeanroy.junit.servers.servers.AbstractConfiguration in project junit-servers by mjeanroy.

the class JunitServerRunnerTest method it_should_instantiate_tomcat_with_configuration.

@Test
void it_should_instantiate_tomcat_with_configuration() throws Exception {
    final JunitServerRunner runner = new JunitServerRunner(TestClassWithConfigurationMethod.class);
    final EmbeddedServer<?> server = (EmbeddedServer<?>) readField(runner, "server", true);
    final AbstractConfiguration conf = (AbstractConfiguration) readField(runner, "configuration", true);
    assertThat(server).isInstanceOf(EmbeddedTomcat.class);
    assertThat(conf).isSameAs(configuration);
}
Also used : AbstractConfiguration(com.github.mjeanroy.junit.servers.servers.AbstractConfiguration) EmbeddedServer(com.github.mjeanroy.junit.servers.servers.EmbeddedServer) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractConfiguration (com.github.mjeanroy.junit.servers.servers.AbstractConfiguration)19 Test (org.junit.jupiter.api.Test)18 EmbeddedServer (com.github.mjeanroy.junit.servers.servers.EmbeddedServer)8 AbstractConfigurationMockBuilder (com.github.mjeanroy.junit.servers.utils.builders.AbstractConfigurationMockBuilder)7 EmbeddedServerMockBuilder (com.github.mjeanroy.junit.servers.utils.builders.EmbeddedServerMockBuilder)4 FixtureClass (com.github.mjeanroy.junit.servers.utils.fixtures.FixtureClass)4 ConfigurationAnnotationHandler.newConfigurationAnnotationHandler (com.github.mjeanroy.junit.servers.engine.ConfigurationAnnotationHandler.newConfigurationAnnotationHandler)3 EmbeddedServerRunner (com.github.mjeanroy.junit.servers.engine.EmbeddedServerRunner)2 EmbeddedJettyConfiguration (com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration)2 EmbeddedTomcatConfiguration (com.github.mjeanroy.junit.servers.tomcat.EmbeddedTomcatConfiguration)2 Fields.getPrivateField (com.github.mjeanroy.junit.servers.utils.commons.Fields.getPrivateField)2 Field (java.lang.reflect.Field)2 AnnotationsHandlerRunner (com.github.mjeanroy.junit.servers.engine.AnnotationsHandlerRunner)1 FakeEmbeddedServerConfiguration (com.github.mjeanroy.junit.servers.utils.impl.FakeEmbeddedServerConfiguration)1 Annotation (java.lang.annotation.Annotation)1