### Question:
FixedThreadPoolExecutor extends AbstractExecutorService { @Override public List<Runnable> shutdownNow() { myStopExecuting = true; myAddLock.lock(); try { myShuttingDown = true; } finally { myAddLock.unlock(); } List<Runnable> unrun = new ArrayList<>(); myQueue.drainTo(unrun); synchronized (myWorkers) { for (Worker worker : myWorkers) { worker.interrupt(); } } return unrun; } FixedThreadPoolExecutor(int nThreads);  FixedThreadPoolExecutor(int nThreads, NamedThreadFactory factory, SuppressableRejectedExecutionHandler handler);  FixedThreadPoolExecutor(int nThreads, ThreadFactory factory);  FixedThreadPoolExecutor(int nThreads, ThreadFactory factory, BlockingQueue<Runnable> queue);  FixedThreadPoolExecutor(int nThreads, ThreadFactory factory, BlockingQueue<Runnable> queue,
            RejectedExecutionHandler handler); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override @SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "No ThreadPoolExecutor available to pass.") void execute(Runnable command); BlockingQueue<Runnable> getQueue(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdown(); @Override List<Runnable> shutdownNow();  }### Answer:
@Test public void testShutdownNow() throws InterruptedException { if (StringUtils.isEmpty(System.getenv("SLOW_MACHINE"))) { ThreadGroup group = createTestThreadGroup(); ThreadFactory factory = new ThreadFactoryImplementation(group); FixedThreadPoolExecutor executor = new FixedThreadPoolExecutor(1, factory); final CountDownLatch latch = new CountDownLatch(1); Runnable task1 = EasyMock.createStrictMock(Runnable.class); task1.run(); EasyMock.expectLastCall().andAnswer(new IAnswer<Void>() { @Override public Void answer() throws InterruptedException { latch.countDown(); Thread.sleep(500); return null; } }); EasyMock.replay(task1); Runnable task2 = EasyMock.createStrictMock(Runnable.class); EasyMock.replay(task2); Runnable task3 = EasyMock.createStrictMock(Runnable.class); EasyMock.replay(task3); Runnable task4 = EasyMock.createStrictMock(Runnable.class); EasyMock.replay(task4); Future<?> future1 = executor.submit(task1); executor.execute(task2); executor.execute(task3); executor.execute(task4); Assert.assertTrue(latch.await(1, TimeUnit.SECONDS)); List<Runnable> unrun = executor.shutdownNow(); Assert.assertEquals(3, unrun.size()); Assert.assertEquals(task2, unrun.get(0)); Assert.assertEquals(task3, unrun.get(1)); Assert.assertEquals(task4, unrun.get(2)); Assert.assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS)); Thread.yield(); if (group.activeCount() > 0) { Thread.sleep(500); } Assert.assertEquals(0, group.activeCount()); try { future1.get(); Assert.fail("Should have been interrupted."); } catch (ExecutionException e) { Assert.assertEquals(InterruptedException.class, e.getCause().getCause().getClass()); } EasyMock.verify(task1); } }