Throwable (@NotNull Runnable runnable) { AtomicReference<Throwable> error = new AtomicReference<>(); executeWith(new LoggedErrorProcessor() { @Override public @NotNull Set<Action> processError(@NotNull String category, @NotNull String message, String @NotNull [] details, @Nullable Throwable t) { Assert.assertNotNull("Unexpected error without Throwable: " + message, t); if (!error.compareAndSet(null, t)) { Assert.fail("Multiple errors were reported: " + error.get().getMessage() + " and " + t.getMessage()); } return Action.NONE; } }, () -> runnable.run()); Throwable result = error.get(); Assert.assertNotNull("No errors were logged", result); return result; }