StatusManager { protected StatusManager() { init(); } protected  StatusManager(); static StatusManager getInstance(); int getQueueSize(); synchronized void startingWork(); synchronized void stoppingWork(); synchronized void successfulCompletion(SyncSummary summary); synchronized void failedCompletion(SyncSummary file); long getInWork(); long getSucceeded(); synchronized List<SyncSummary> getFailed(); synchronized List<SyncSummary> getRecentlyCompleted(); void setVersion(String version); void clearFailed(); void clear(); String getPrintableStatus();  }
@Test public void testStatusManager() { StatusManager status = new StatusManager(); assertEquals(0, status.getInWork()); assertEquals(0, status.getSucceeded()); assertEquals(0, status.getFailed().size()); for (int i = 0; i < 100; i++) { status.startingWork(); } assertEquals(100, status.getInWork()); assertEquals(0, status.getSucceeded()); assertEquals(0, status.getFailed().size()); for (int i = 0; i < 50; i++) { status.successfulCompletion(new SyncSummary(new File("test"), new Date(), new Date(), SyncResultType.ADDED, "success")); } assertEquals(50, status.getInWork()); assertEquals(50, status.getSucceeded()); assertEquals(0, status.getFailed().size()); for (int i = 0; i < 50; i++) { status.failedCompletion(new SyncSummary(new File("test"), new Date(), new Date(), SyncResultType.FAILED, "failure")); } assertEquals(0, status.getInWork()); assertEquals(50, status.getSucceeded()); assertEquals(50, status.getFailed().size()); }