### Question:
PieExecutorService extends ThreadPoolExecutor implements IExecutorService, IShutdownableService { @Override public void handlePieEvent(IPieEvent event) throws PieExecutorTaskFactoryException { IPieEventTask task = this.executorFactory.getTask(event); this.execute(task); } PieExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue);  PieExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory);  PieExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler);  PieExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler); static PieExecutorService newCachedPieExecutorService(); void setExecutorFactory(IPieExecutorTaskFactory executorFactory); @Override void execute(IPieTask task); @Override void handlePieEvent(IPieEvent event); @Override void shutdown();  }### Answer:
@Test public void testHandlePieEvent() throws Exception { IPieEvent event = Mockito.mock(IPieEvent.class); IPieEventTask task = Mockito.mock(IPieEventTask.class); IPieExecutorTaskFactory factory = Mockito.mock(IPieExecutorTaskFactory.class); Mockito.when(factory.getTask(event)).thenReturn(task); PieExecutorService instance = PieExecutorService.newCachedPieExecutorService(); instance.setExecutorFactory(factory); instance.handlePieEvent(event); Mockito.verify(task, Mockito.timeout(1000).times(1)).run(); }