Search in sources :

Example 1 with EmbeddedJettyConfigurationMockBuilder

use of com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyConfigurationMockBuilder in project junit-servers by mjeanroy.

the class EmbeddedJettyProviderTest method it_should_instantiate_jetty_with_custom_configuration.

@Test
void it_should_instantiate_jetty_with_custom_configuration() {
    final EmbeddedJettyProvider provider = new EmbeddedJettyProvider();
    final EmbeddedJettyConfiguration configuration = new EmbeddedJettyConfigurationMockBuilder().build();
    final EmbeddedJetty jetty = provider.instantiate(configuration);
    assertThat(jetty).isNotNull();
    assertThat(jetty.getConfiguration()).isNotNull().isSameAs(configuration);
}
Also used : EmbeddedJettyConfigurationMockBuilder(com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyConfigurationMockBuilder) Test(org.junit.jupiter.api.Test)

Example 2 with EmbeddedJettyConfigurationMockBuilder

use of com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyConfigurationMockBuilder in project junit-servers by mjeanroy.

the class JettyServerJunit4RuleTest method it_should_create_rule_with_server.

@Test
void it_should_create_rule_with_server() throws Throwable {
    final EmbeddedJettyConfiguration config = new EmbeddedJettyConfigurationMockBuilder().build();
    final EmbeddedJetty jetty = new EmbeddedJettyMockBuilder().withConfiguration(config).build();
    final JettyServerJunit4Rule rule = createRule(jetty);
    assertThat(rule.getServer()).isSameAs(jetty);
    assertThat(rule.getScheme()).isEqualTo(jetty.getScheme());
    assertThat(rule.getHost()).isEqualTo(jetty.getHost());
    assertThat(rule.getPort()).isEqualTo(jetty.getPort());
    assertThat(rule.getPath()).isEqualTo(jetty.getPath());
    assertThat(rule.getUrl()).isEqualTo(jetty.getUrl());
    verify(jetty, never()).start();
    verify(jetty, never()).stop();
    evaluateRule(rule);
    InOrder inOrder = Mockito.inOrder(jetty);
    inOrder.verify(jetty).start();
    inOrder.verify(jetty).stop();
}
Also used : EmbeddedJettyConfigurationMockBuilder(com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyConfigurationMockBuilder) EmbeddedJetty(com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty) InOrder(org.mockito.InOrder) EmbeddedJettyMockBuilder(com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyMockBuilder) EmbeddedJettyConfiguration(com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

EmbeddedJettyConfigurationMockBuilder (com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyConfigurationMockBuilder)2 Test (org.junit.jupiter.api.Test)2 EmbeddedJetty (com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty)1 EmbeddedJettyConfiguration (com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration)1 EmbeddedJettyMockBuilder (com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyMockBuilder)1 InOrder (org.mockito.InOrder)1