@Test public void testSaveExceptionsInCase() throws Exception { TestSuite ts = new TestSuite(); when(loader.getTestSuite()).thenReturn(ts); TestCase tc = new TestCase(null, null); when(loader.getCurrentTestCase()).thenReturn(tc); testling.saveException(new SakuliCheckedException("test")); assertNull(ts.getException()); assertEquals(tc.getException().getMessage(), "test"); }
void saveException(Exception e) { if (e instanceof SakuliException) { if (((SakuliException) e).getAsyncTestDataRef().isPresent()) { ((SakuliException) e).getAsyncTestDataRef().get().addException(e); return; } } if (loader.getCurrentTestCase() != null) { if (loader.getCurrentTestCaseStep() != null) { loader.getCurrentTestCaseStep().addException(e); loader.getCurrentTestCaseStep().addActions(loader.getCurrentTestCase().getAndResetTestActions()); } else { loader.getCurrentTestCase().addException(e); } } else { loader.getTestSuite().addException(e); } loader.getTestSuite().refreshState(); }
SakuliExceptionHandler { void saveException(Exception e) { if (e instanceof SakuliException) { if (((SakuliException) e).getAsyncTestDataRef().isPresent()) { ((SakuliException) e).getAsyncTestDataRef().get().addException(e); return; } } if (loader.getCurrentTestCase() != null) { if (loader.getCurrentTestCaseStep() != null) { loader.getCurrentTestCaseStep().addException(e); loader.getCurrentTestCaseStep().addActions(loader.getCurrentTestCase().getAndResetTestActions()); } else { loader.getCurrentTestCase().addException(e); } } else { loader.getTestSuite().addException(e); } loader.getTestSuite().refreshState(); } }
SakuliExceptionHandler { void saveException(Exception e) { if (e instanceof SakuliException) { if (((SakuliException) e).getAsyncTestDataRef().isPresent()) { ((SakuliException) e).getAsyncTestDataRef().get().addException(e); return; } } if (loader.getCurrentTestCase() != null) { if (loader.getCurrentTestCaseStep() != null) { loader.getCurrentTestCaseStep().addException(e); loader.getCurrentTestCaseStep().addActions(loader.getCurrentTestCase().getAndResetTestActions()); } else { loader.getCurrentTestCase().addException(e); } } else { loader.getTestSuite().addException(e); } loader.getTestSuite().refreshState(); }  }
SakuliExceptionHandler { void saveException(Exception e) { if (e instanceof SakuliException) { if (((SakuliException) e).getAsyncTestDataRef().isPresent()) { ((SakuliException) e).getAsyncTestDataRef().get().addException(e); return; } } if (loader.getCurrentTestCase() != null) { if (loader.getCurrentTestCaseStep() != null) { loader.getCurrentTestCaseStep().addException(e); loader.getCurrentTestCaseStep().addActions(loader.getCurrentTestCase().getAndResetTestActions()); } else { loader.getCurrentTestCase().addException(e); } } else { loader.getTestSuite().addException(e); } loader.getTestSuite().refreshState(); }  static List<Exception> getAllExceptions(TestSuite testSuite); static Path getScreenshotFile(Exception e); static Exception castTo(SakuliException e); void handleException(Exception e); boolean isAlreadyProcessed(Exception e); boolean resumeToTestExecution(Exception e); void handleException(Exception e, boolean resumeOnException); void handleException(String exceptionMessage, boolean resumeOnException); void handleException(String exceptionMessage, RegionImpl lastRegion, boolean resumeOnException); void handleException(Exception e, RegionImpl lastRegion, boolean resumeOnException); void handleException(LogResult logResult); }
SakuliExceptionHandler { void saveException(Exception e) { if (e instanceof SakuliException) { if (((SakuliException) e).getAsyncTestDataRef().isPresent()) { ((SakuliException) e).getAsyncTestDataRef().get().addException(e); return; } } if (loader.getCurrentTestCase() != null) { if (loader.getCurrentTestCaseStep() != null) { loader.getCurrentTestCaseStep().addException(e); loader.getCurrentTestCaseStep().addActions(loader.getCurrentTestCase().getAndResetTestActions()); } else { loader.getCurrentTestCase().addException(e); } } else { loader.getTestSuite().addException(e); } loader.getTestSuite().refreshState(); }  static List<Exception> getAllExceptions(TestSuite testSuite); static Path getScreenshotFile(Exception e); static Exception castTo(SakuliException e); void handleException(Exception e); boolean isAlreadyProcessed(Exception e); boolean resumeToTestExecution(Exception e); void handleException(Exception e, boolean resumeOnException); void handleException(String exceptionMessage, boolean resumeOnException); void handleException(String exceptionMessage, RegionImpl lastRegion, boolean resumeOnException); void handleException(Exception e, RegionImpl lastRegion, boolean resumeOnException); void handleException(LogResult logResult);  }