### Question:
SakuliExceptionHandler { public void handleException(Exception e) { if (e.getMessage() == null) { e = new SakuliCheckedException(e, e.getClass().getSimpleName()); } if (!(e instanceof SakuliInitException) || (!containsException(loader.getTestSuite()))) { if (isAlreadyProcessed(e)) { logger.debug("ALREADY PROCESSED: " + e.getMessage(), e); } else { processException(e); } } }  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);  }### Answer:
@Test public void testHandleException() throws Exception { setUp(); when(loader.getCurrentTestCase()).thenReturn(null); testling.handleException(new Exception(testExcMessage)); assertTrue(testSuite.getException() instanceof SakuliCheckedException); assertEquals(testSuite.getException().getMessage(), testExcMessage); assertEquals(testSuite.getScreenShotPath(), expectedScreenshotPath); String excpMessage2 = "ExceptionSuppressed"; testling.handleException(new Exception(excpMessage2)); assertEquals(testSuite.getExceptionMessages(false), testExcMessage + "\n\t\tSuppressed EXCEPTION: " + excpMessage2); assertEquals(testSuite.getState(), TestSuiteState.ERRORS); assertTrue(testling.isAlreadyProcessed(testSuite.getException())); }
@Test public void testHandleActionException() throws Exception { setUp(); when(loader.getCurrentTestCase()).thenReturn(null); testling.handleException(new SakuliActionException(testExcMessage)); assertTrue(testSuite.getException() instanceof SakuliCheckedException); assertEquals(testSuite.getException().getMessage(), testExcMessage); assertEquals(testSuite.getScreenShotPath(), expectedScreenshotPath); }
@Test public void testHandleSakuliProxyExceptionForTestCases() throws Exception { setUp(); when(loader.getCurrentTestCase()).thenReturn(null); testling.handleException(new SakuliInitException(testExcMessage)); assertTrue(testSuite.getException() instanceof NonScreenshotException); assertEquals(testSuite.getException().getMessage(), testExcMessage); assertEquals(testSuite.getState(), TestSuiteState.ERRORS); verify(loader, never()).getScreenshotActions(); }
@Test public void testSakuliValidationException() throws Exception { setUp(); when(loader.getCurrentTestCase()).thenReturn(null); testling.handleException(new SakuliValidationException(testExcMessage)); assertTrue(testSuite.getException() instanceof NonScreenshotException); assertEquals(testSuite.getException().getMessage(), testExcMessage); assertEquals(testSuite.getState(), TestSuiteState.ERRORS); verify(loader, never()).getScreenshotActions(); }