### Question:
ExceptionUtils { public static void propagateVoid(final CheckedRunnable runnable) { propagateVoid(runnable, RuntimeException::new); } private  ExceptionUtils(); static void propagateVoid(final CheckedRunnable runnable); static void propagateVoid(
      final CheckedRunnable runnable, final Function<Exception, E> wrap); static T propagate(final Callable<T> callable); static T propagate(
      final Callable<T> callable, final Function<Exception, E> wrap);  }### Answer:
@Test public void propagateVoidDoesNotThrowExceptionOnSuccess() { ExceptionUtils.propagateVoid(() -> {}); Assertions.assertTrue(true, "No Problems"); }
@Test public void propagateVoidAllowsRuntimeExceptionsToPropagate() { Assertions.assertThrows( IllegalArgumentException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new IllegalArgumentException(); })); }
@Test public void propagateVoidWrapsCheckedExceptionsInRuntimeExceptionByDefault() { Assertions.assertThrows( RuntimeException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new IOException(); })); }
@Test public void propagateVoidCanWrapCheckedExceptionsInCustomRuntimeException() { Assertions.assertThrows( IllegalArgumentException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new IOException(); }, IllegalArgumentException::new)); }
@Test public void propagateVoidUnwrapsUncheckedExecutionExceptions() { Assertions.assertThrows( IllegalArgumentException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new MockExecutionException(new IllegalArgumentException()); })); }
@Test public void propagateVoidWrapsCheckedExecutionExceptionsInRuntimeExceptionByDefault() { Assertions.assertThrows( RuntimeException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new MockExecutionException(new IOException()); })); }
@Test public void propagateVoidCanWrapCheckedExecutionExceptionsInCustomRuntimeException() { Assertions.assertThrows( IllegalArgumentException.class, () -> ExceptionUtils.propagateVoid( () -> { throw new MockExecutionException(new IOException()); }, IllegalArgumentException::new)); }
@Test public void propagateVoidMapsInterruptedExceptionToIllegalStateException() throws InterruptedException { final InterruptedExceptionTestRunner runner = new InterruptedExceptionTestRunner( () -> { ExceptionUtils.propagateVoid(() -> Thread.sleep(1000)); return null; }); runner.run(); MatcherAssert.assertThat(runner.getUnhandledException(), IsNull.notNullValue()); MatcherAssert.assertThat( runner.getUnhandledException(), IsInstanceOf.instanceOf(IllegalStateException.class)); }
@Test public void propagateVoidSetsThreadInterruptFlagWhenMappingInterruptedException() throws InterruptedException { final InterruptedExceptionTestRunner runner = new InterruptedExceptionTestRunner( () -> { ExceptionUtils.propagateVoid(() -> Thread.sleep(1000)); return null; }); runner.run(); MatcherAssert.assertThat(runner.isInterruptedPreRun(), IsEqual.equalTo(false)); MatcherAssert.assertThat(runner.isInterruptedPostRun(), IsEqual.equalTo(true)); }