use of com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyMockBuilder 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();
}
use of com.github.mjeanroy.junit.servers.jetty.tests.EmbeddedJettyMockBuilder in project junit-servers by mjeanroy.
the class JettyServerExtensionTest method it_should_start_given_jetty_server_before_all_tests.
@Test
void it_should_start_given_jetty_server_before_all_tests() {
final EmbeddedJetty jetty = new EmbeddedJettyMockBuilder().build();
final JettyServerExtension extension = new JettyServerExtension(jetty);
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(jetty);
assertThat(serverAdapter.getServer().isStarted()).isTrue();
}
Aggregations