StatusManager { private StatusManager() { reset(); } private  StatusManager(); static StatusManager getInstance(); synchronized void startingWork(); synchronized void noChangeCompletion(); synchronized void successfulCompletion(); synchronized void failedCompletion(); long getInWork(); long getNoChange(); long getSucceeded(); long getFailed(); void setVersion(String version); String getPrintableStatus();  }
@Test public void testStatusManager() { StatusManager status = StatusManager.getInstance(); status.reset(); assertEquals(0, status.getInWork()); assertEquals(0, status.getSucceeded()); assertEquals(0, status.getNoChange()); assertEquals(0, status.getFailed()); for (int i = 0; i < 150; i++) { status.startingWork(); } assertEquals(150, status.getInWork()); assertEquals(0, status.getSucceeded()); assertEquals(0, status.getNoChange()); assertEquals(0, status.getFailed()); for (int i = 0; i < 50; i++) { status.successfulCompletion(); } assertEquals(100, status.getInWork()); assertEquals(50, status.getSucceeded()); assertEquals(0, status.getNoChange()); assertEquals(0, status.getFailed()); for (int i = 0; i < 50; i++) { status.noChangeCompletion(); } assertEquals(50, status.getInWork()); assertEquals(50, status.getSucceeded()); assertEquals(50, status.getNoChange()); assertEquals(0, status.getFailed()); for (int i = 0; i < 50; i++) { status.failedCompletion(); } assertEquals(0, status.getInWork()); assertEquals(50, status.getSucceeded()); assertEquals(50, status.getNoChange()); assertEquals(50, status.getFailed()); }