### Question:
VirtualExecutorService extends AbstractExecutorService { @Override public List<Runnable> shutdownNow() { synchronized (_pendingLock) { _stage = STAGE_SHUTDOWN_NOW; for (Thread pending : LinkedNode.values(_pendingThreads)) { pending.interrupt(); } return LinkedNode.values(_pendingRunnables); } } VirtualExecutorService(Executor executor); @Override void shutdown(); @Override List<Runnable> shutdownNow(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override void execute(Runnable command);  }### Answer:
@Test public void shutdownNowTest() throws InterruptedException, ExecutionException { ExecutorService baseExecutor = Executors.newFixedThreadPool(4); VirtualExecutorService virtualExecutor = new VirtualExecutorService(baseExecutor); for (int i = 0; i < 10; i++) { virtualExecutor.submit(Interrupted.unchecked(() -> { while (true) { Thread.sleep(Long.MAX_VALUE); } })); } Thread.sleep(100); List<Runnable> list = virtualExecutor.shutdownNow(); Assert.assertEquals(6, list.size()); virtualExecutor.awaitTermination(10, TimeUnit.SECONDS); Assert.assertTrue(virtualExecutor.isTerminated()); Assert.assertFalse(baseExecutor.isTerminated()); try { virtualExecutor.submit(() -> 5); Assert.fail(); } catch (RejectedExecutionException e) { } catch (Exception e) { Assert.fail(); } Assert.assertEquals((int) (baseExecutor.submit(() -> 8).get()), 8); }