void () { ExecutorService executor = AppExecutorUtil.createBoundedApplicationPoolExecutor(getPoolName(),AppExecutorUtil.getAppExecutorService(), 1); Throwable error = LoggedErrorProcessor.executeAndReturnLoggedError(() -> { try { AtomicBoolean executed = new AtomicBoolean(); executor.execute(() -> { try { throw new Error("error "+getName()); } finally { executed.set(true); } }); while (!executed.get()) {} TimeoutUtil.sleep(100); // that tiny moment between throwing new Error() and catching it in BoundedTaskExecutor.wrapAndExecute() } finally { executor.shutdownNow(); } }); assertEquals("error " + getName(), error.getMessage()); }