public void after() throws Throwable { DropwizardTestResourceConfig.CONFIGURATION_REGISTRY.remove(configuration.getId()); requireNonNull(test).tearDown(); } }
public void tearDown() throws Exception _jerseyTest.tearDown();
public void after() throws Throwable { DropwizardTestResourceConfig.CONFIGURATION_REGISTRY.remove(configuration.getId()); requireNonNull(test).tearDown(); } }
public void tearDown() throws Exception { log.info("tearDown in class: {}", this.getClass().getCanonicalName()); super.tearDown(); } protected int getTestPort() {
/** * <ol> * <li>calls {@link JerseyTest#setUp()} * <li>passes the initialized JerseyTest to the consumer. * <li>calls {@link JerseyTest#tearDown()} * </ol> * * @param jerseyTest * @param test * @throws Exception */ public void runJerseyTest(JerseyTest jerseyTest, ThrowingConsumer<JerseyTest> test) throws Exception { try { jerseyTest.setUp(); test.accept(jerseyTest); } finally { jerseyTest.tearDown(); } }
@AfterEach @Override // JerseyTest#tearDown is annotated with @After and as such not invoked by JUnit 5 => invoke public void tearDown() throws Exception { super.tearDown(); }
@AfterEach @Override // JerseyTest#tearDown is annotated with @After and as such not invoked by JUnit 5 => invoke public void tearDown() throws Exception { super.tearDown(); }
@AfterAll public void after() throws Exception { super.tearDown(); System.clearProperty(CONFIG_HTTP_BASE_URL); }
@AfterEach @Override // JerseyTest#tearDown is annotated with @After and as such not invoked by JUnit 5 => invoke public void tearDown() throws Exception { super.tearDown(); }
@AfterAll public void after() throws Exception { super.tearDown(); }
@Test public void testCallSetupConsumerAndTearDownInOrder() throws Exception { runner.runJerseyTest(jerseyTest, consumer); InOrder inOrder = Mockito.inOrder(jerseyTest, consumer); inOrder.verify(jerseyTest).setUp(); inOrder.verify(consumer).accept(jerseyTest); inOrder.verify(jerseyTest).tearDown(); }
@Test public void testCallsTearDownOnConsumerException() throws Exception { doThrow(new Exception("whatever")).when(consumer).accept(jerseyTest); try { runner.runJerseyTest(jerseyTest, consumer); fail("expected exception to be thrown"); } catch (Exception e) { ; } verify(jerseyTest).tearDown(); }
@Test public void testRethrowsExceptionOnTearDownFailure() throws Exception { RuntimeException thrownException = new RuntimeException("whatever"); doThrow(thrownException).when(jerseyTest).tearDown(); try { runner.runJerseyTest(jerseyTest, consumer); fail("expected exception to be thrown"); } catch (RuntimeException re) { assertSame(thrownException, re); } }
@Test public void testTearsDownTestOnSetupFailure() throws Exception { doThrow(new RuntimeException()).when(jerseyTest).setUp(); try { runner.runJerseyTest(jerseyTest, consumer); fail("expected exception to be thrown"); } catch (RuntimeException re) { } verify(jerseyTest).setUp(); verify(jerseyTest).tearDown(); }
@Test public void testRethrowsTearDownExceptionOnConsumerAndTearDownFailure() throws Exception { Exception consumerException = new Exception("whatever"); doThrow(consumerException).when(consumer).accept(jerseyTest); RuntimeException tearDownException = new RuntimeException("whatever"); doThrow(tearDownException).when(jerseyTest).tearDown(); try { runner.runJerseyTest(jerseyTest, consumer); fail("expected exception to be thrown"); } catch (Exception e) { assertSame(tearDownException, e); } } }
if (!isAlive()) { try { harness.tearDown(); } catch (Exception e) { throw new IllegalStateException(sb.toString(), e);
if (!isAlive()) { try { harness.tearDown(); } catch (Exception e) { throw new IllegalStateException(sb.toString(), e);
jerseyTest.tearDown();
getHarness().tearDown();
getHarness().tearDown();