ExceptionUtils { public static <T, E extends Exception> Supplier<T> rethrowSupplier(SupplierWithExceptions<T, E> supplier) { return () -> { try { return supplier.get(); } catch (Exception exception) { throwAsUnchecked(exception); return null; } }; } private  ExceptionUtils(); static T uncheck(SupplierWithExceptions<T, E> supplier); static Supplier<T> rethrowSupplier(SupplierWithExceptions<T, E> supplier);  }
@Test public void rethrowSupplierRethrowsException() throws Exception { expected.expect(MalformedURLException.class); expected.expectMessage("no protocol: not existing url"); rethrowSupplier(() -> new URL("not existing url")).get(); }