@Test void testWithException() { SafeExecutor safeExecutor = new SafeExecutor(exceptionHandler); Exception e = new Exception(); safeExecutor.execute(() -> { throw e; }); Mockito.verify(exceptionHandler) .accept(e); }
public <E extends Exception> void execute(FailableRunnable<E> runnable) { try { runnable.run(); } catch (Exception e) { exceptionHandler.accept(e); } }
SafeExecutor { public <E extends Exception> void execute(FailableRunnable<E> runnable) { try { runnable.run(); } catch (Exception e) { exceptionHandler.accept(e); } } }
SafeExecutor { public <E extends Exception> void execute(FailableRunnable<E> runnable) { try { runnable.run(); } catch (Exception e) { exceptionHandler.accept(e); } } SafeExecutor();  SafeExecutor(Consumer<Exception> exceptionHandler); }
SafeExecutor { public <E extends Exception> void execute(FailableRunnable<E> runnable) { try { runnable.run(); } catch (Exception e) { exceptionHandler.accept(e); } } SafeExecutor();  SafeExecutor(Consumer<Exception> exceptionHandler); void execute(FailableRunnable<E> runnable); }
SafeExecutor { public <E extends Exception> void execute(FailableRunnable<E> runnable) { try { runnable.run(); } catch (Exception e) { exceptionHandler.accept(e); } } SafeExecutor();  SafeExecutor(Consumer<Exception> exceptionHandler); void execute(FailableRunnable<E> runnable);  }