### Question:
ReportPublisher implements Runnable { private void publishReport() { try { context.addReport(getReport()); } catch (IOException e) { LOG.error("Exception while publishing report.", e); } }  void init(StateContext stateContext,
                   ScheduledExecutorService executorService); void setConf(ConfigurationSource conf); ConfigurationSource getConf(); @Override void run();  }### Answer:
@Test public void testPublishReport() throws InterruptedException { ReportPublisher publisher = new DummyReportPublisher(100); StateContext dummyContext = Mockito.mock(StateContext.class); ScheduledExecutorService executorService = HadoopExecutors .newScheduledThreadPool(1, new ThreadFactoryBuilder().setDaemon(true) .setNameFormat("Unit test ReportManager Thread - %d").build()); publisher.init(dummyContext, executorService); Thread.sleep(150); executorService.shutdown(); Assert.assertEquals(1, ((DummyReportPublisher) publisher).getReportCount); verify(dummyContext, times(1)).addReport(null); }