EventPoller implements Runnable { void stop() { runnable = false; } EventPoller(EventSource eventSource, EventChannel<T> eventChannel); void run();  }
@Test(groups = SMALL) public void testPollerStopsWhenStopMethodIsCalled() throws InterruptedException, NoSuchMethodException, SecurityException { Thread pollerThread = startPollingThread(); poller.stop(); sleep(100L); assertEquals(pollerThread.getState(), TERMINATED); }
@Test(groups = SMALL) public void testWhenPollerStopsInvokesTheCleanupMethodOfTheEventSource() throws InterruptedException { startPollingThread(); poller.stop(); sleep(100L); verify(evtSource).cleanup(); }
@Test(groups = SMALL) public void testWhenPollerStopsInvokesTheDisconnectMethodOfTheEventSource() throws InterruptedException { startPollingThread(); poller.stop(); sleep(100L); verify(evtSource).disconnect(); }