@Test public void testHandleTeardownExceptionAsync() { final TestCase testCase = testsuite.getTestCases().values().stream().findFirst().get(); testling.tearDown(Optional.of(testCase), true); verify(exceptionHandler).handleException(any(SakuliRuntimeException.class)); verify(testling).addTestRef(any(SakuliRuntimeException.class), eq(testCase)); List<Exception> resumeExceptions = (List<Exception>) ReflectionTestUtils.getField(exceptionHandler, "resumeExceptions"); assertTrue(resumeExceptions.stream().allMatch(e -> e.getClass().isAssignableFrom(SakuliRuntimeException.class))); assertNull(testsuite.getException()); assertEquals(testCase.getException().getClass(), SakuliRuntimeException.class); assertEquals(testCase.getException().toString(), "teardown test case"); }
Exception addTestRef(@NonNull Exception e, @NonNull AbstractTestDataEntity testDataRef) { if (!(e instanceof SakuliException)) { e = new SakuliCheckedException(e); } ((SakuliException) e).setAsyncTestDataRef(testDataRef); return e; }
AbstractTeardownService implements TeardownService { Exception addTestRef(@NonNull Exception e, @NonNull AbstractTestDataEntity testDataRef) { if (!(e instanceof SakuliException)) { e = new SakuliCheckedException(e); } ((SakuliException) e).setAsyncTestDataRef(testDataRef); return e; } }
AbstractTeardownService implements TeardownService { Exception addTestRef(@NonNull Exception e, @NonNull AbstractTestDataEntity testDataRef) { if (!(e instanceof SakuliException)) { e = new SakuliCheckedException(e); } ((SakuliException) e).setAsyncTestDataRef(testDataRef); return e; }  }
AbstractTeardownService implements TeardownService { Exception addTestRef(@NonNull Exception e, @NonNull AbstractTestDataEntity testDataRef) { if (!(e instanceof SakuliException)) { e = new SakuliCheckedException(e); } ((SakuliException) e).setAsyncTestDataRef(testDataRef); return e; }  @Override void handleTeardownException(@NonNull Exception e, boolean async, @NonNull AbstractTestDataEntity testDataRef); @Override void teardownTestCase(@NonNull TestCase testCase); @Override void teardownTestCaseStep(@NonNull TestCaseStep testCaseStep); }
AbstractTeardownService implements TeardownService { Exception addTestRef(@NonNull Exception e, @NonNull AbstractTestDataEntity testDataRef) { if (!(e instanceof SakuliException)) { e = new SakuliCheckedException(e); } ((SakuliException) e).setAsyncTestDataRef(testDataRef); return e; }  @Override void handleTeardownException(@NonNull Exception e, boolean async, @NonNull AbstractTestDataEntity testDataRef); @Override void teardownTestCase(@NonNull TestCase testCase); @Override void teardownTestCaseStep(@NonNull TestCaseStep testCaseStep);  }