WaiterExecutorServiceFactory { public static ExecutorService buildExecutorServiceForWaiter(String name) { return Executors.newCachedThreadPool(NamedDefaultThreadFactory.of(name)); }  static ExecutorService buildExecutorServiceForWaiter(String name);  }
@Test(timeout = 10000L) public void executorUnderLoadDoesNotRejectTasks() throws Exception { ExecutorService executorService = WaiterExecutorServiceFactory.buildExecutorServiceForWaiter("fake-waiter"); for (int i = 0; i < 1000; ++i) { executorService.submit(slowRunnable); } executorService.shutdown(); executorService.awaitTermination(10000, TimeUnit.MILLISECONDS); Assert.assertEquals(1000, atomicCounter.get()); }