### Question:
Unchecked { public static <T> Consumer<T> consumer(CheckedConsumer<T> consumer) { return (t) -> { try { consumer.accept(t); } catch (Throwable ex) { throw propagate(ex); } }; } private  Unchecked(); static void wrap(CheckedRunnable block); static T wrap(CheckedSupplier<T> block); static Runnable runnable(CheckedRunnable runnable); static Function<T, R> function(CheckedFunction<T, R> function); static BiFunction<T, U, R> biFunction(CheckedBiFunction<T, U, R> function); static UnaryOperator<T> unaryOperator(CheckedUnaryOperator<T> function); static BinaryOperator<T> binaryOperator(CheckedBinaryOperator<T> function); static Predicate<T> predicate(CheckedPredicate<T> predicate); static BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate); static Consumer<T> consumer(CheckedConsumer<T> consumer); static BiConsumer<T, U> biConsumer(CheckedBiConsumer<T, U> consumer); static Supplier<R> supplier(CheckedSupplier<R> supplier); static RuntimeException propagate(Throwable throwable);  }### Answer:
@Test public void test_consumer_success() { Consumer<String> a = Unchecked.consumer((t) -> {}); a.accept("A"); }
@Test public void test_consumer_fail1() { Consumer<String> a = Unchecked.consumer((t) -> { throw new IOException(); }); assertThatExceptionOfType(UncheckedIOException.class).isThrownBy(() -> a.accept("A")); }
@Test public void test_consumer_fail2() { Consumer<String> a = Unchecked.consumer((t) -> { throw new Exception(); }); assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> a.accept("A")); }