### Question:
ConveyorQueueTimerTask extends TimerTask { public void init() { log.info("init"); if (conveyorService == null) { throw new ConveyorRuntimeException("conveyorService not set"); } initDone = true; } ConveyorQueueTimerTask(); void init(); @Override void run(); ConveyorService getConveyorService(); void setConveyorService(final ConveyorService conveyorService); synchronized boolean isPaused(); synchronized void setPaused(final boolean paused);  }### Answer:
@Test public void testInit() throws Exception { ConveyorService conveyorService = Mockito.mock(ConveyorService.class); QueueManagerService queueManager = Mockito .mock(QueueManagerService.class); conveyorService.setQueueManagerService(queueManager); Mockito.when(conveyorService.getQueueManagerService()).thenReturn( queueManager); ConveyorQueueTimerTask timer = new ConveyorQueueTimerTask(); timer.setConveyorService(conveyorService); timer.init(); timer.run(); Mockito.verify(queueManager).dequeueNextOperation(); }
@Test(expected = ConveyorRuntimeException.class) public void testInitNoConveyor() throws Exception { ConveyorQueueTimerTask timer = new ConveyorQueueTimerTask(); timer.init(); }