### Question:
ThreadPoolUtils { public static void shutdownGraceful(ExecutorService executorService) { doShutdown(executorService, DEFAULT_SHUTDOWN_AWAIT_TERMINATION); }  static void shutdown(ExecutorService executorService); static List<Runnable> shutdownNow(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService); static void shutdownGraceful(ExecutorService executorService, long shutdownAwaitTermination); static boolean awaitTermination(ExecutorService executorService, long shutdownAwaitTermination); static final long DEFAULT_SHUTDOWN_AWAIT_TERMINATION; }### Answer:
@Test(timeout=10000) public void testShutdownGraceful() throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); ThreadPoolUtils.shutdownGraceful(service); assertTrue(service.isShutdown()); }
@Test(timeout=10000) public void testShutdownGracefulWithTimeout() throws Exception { ExecutorService service = Executors.newSingleThreadExecutor(); ThreadPoolUtils.shutdownGraceful(service, 1000); assertTrue(service.isShutdown()); }