### Question:
VirtualExecutorService extends AbstractExecutorService { public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { synchronized (startStopLock) { if (!isTerminated()) { startStopLock.wait(TimeUnit.MILLISECONDS.convert(timeout, unit)); } return isTerminated(); } } VirtualExecutorService(Executor parent); boolean isShutdown(); boolean isTerminated(); void shutdown(); List<Runnable> shutdownNow(); boolean awaitTermination(long timeout, TimeUnit unit); void execute(Runnable command);  }### Answer:
@Test public void awaitTerminationTest() throws InterruptedException { final CountDownLatch started = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1); Runnable task = new Runnable() { public void run() { try { started.countDown(); latch.await(); } catch (InterruptedException e) { } } }; ExecutorService executorService = Executors.newCachedThreadPool(); VirtualExecutorService virtualExecutorService = new VirtualExecutorService(executorService); virtualExecutorService.execute(task); started.await(); virtualExecutorService.shutdown(); assertFalse(virtualExecutorService.awaitTermination(1, TimeUnit.SECONDS)); latch.countDown(); assertTrue(virtualExecutorService.awaitTermination(1, TimeUnit.SECONDS)); }