@Test public void testSetWriter() { StringWriter sw = new StringWriter(); sLogger.setWriter(sw); assertEquals(sw, sLogger.getOutput()); }
// 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(); }