void (Function<? super Runnable, ? extends ScheduledFuture<?>> runner) { Runnable fail = () -> { throw new RuntimeException("failed"); }; Throwable error = LoggedErrorProcessor.executeAndReturnLoggedError(() -> { ScheduledFuture<?> future = runner.apply(fail); waitFor(future::isDone); }); assertEquals("failed", error.getMessage()); }