WorkerExecutionMonitorServiceImpl implements WorkerExecutionMonitorService { @Override public void collectMonitorInformation() { if(logger.isDebugEnabled()) { logger.debug("Collecting Worker Monitors"); } try { Map<WorkerMonitorInfoEnum, Serializable> monitorInfo = workerMonitors.getMonitorInfo(); if(logger.isDebugEnabled()) { logger.debug("Sending Worker Monitors Info:[" + monitorInfo +"]"); } ScoreEvent event = new ScoreEvent(EventConstants.WORKER_EXECUTION_MONITOR, (Serializable) monitorInfo); eventBus.dispatch(event); } catch (InterruptedException e) { logger.error("Failed to dispatch monitor info event", e); } }  @Override void collectMonitorInformation(); @Override void executeScheduledWorkerMonitors();  }
@Test public void testWorkerExecutionMonitorServiceCollectMonitor() throws InterruptedException { HashMap<WorkerMonitorInfoEnum, Serializable> monitorInfo = new HashMap<>(); when(workerMonitors.getMonitorInfo()).thenReturn(monitorInfo); ScoreEvent scoreEvent = new ScoreEvent(EventConstants.WORKER_EXECUTION_MONITOR, monitorInfo); workerExecutionMonitorService.collectMonitorInformation(); verify(eventBus, times(1)).dispatch(refEq(scoreEvent)); }