@Test public void testStart() { assertFalse(sLogger.isRunning()); sLogger.start(); assertTrue(sLogger.isRunning()); }
// Call when not tracking state @Test public void testRunNotTracking() { sLogger.setWriter(new StringWriter()); sLogger.start(); assertTrue(sLogger.isRunning()); ArrayList<StateGroup> grouplist = new ArrayList<>(); grouplist.add(group); resetAll(); expect(mockTracker.isTrackingState()).andReturn(false).anyTimes(); expect(mockTracker.getIoSet()).andReturn(ioSet).anyTimes(); expect(mockTracker.getStateList()).andReturn(grouplist).anyTimes(); replayAll(); Thread t = new Thread( new Runnable() { @Override public void run() { try { Thread.sleep(2500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } sLogger.stop(); } }); t.start(); sLogger.run(); }
@Test public void testIsRunning() { sLogger.start(); assertTrue(sLogger.isRunning()); }