@Test public void testSimpleTimerAsThread() throws InterruptedException { SimpleTimer st = new SimpleTimer(1000); st.start(); Thread.sleep(250); for (int x = 0; x < 5; x++) { assertEquals(x, st.getRound()); Thread.sleep(1000); } }
/** * Start up the progress meter, printing initialization message and starting up the daemon thread * for periodic printing. */ @Requires("progressMeterDaemon != null") private synchronized void start() { timer.start(); lastProgressPrintTime = timer.currentTime(); logger.info("[INITIALIZATION COMPLETE; STARTING PROCESSING]"); logger.info( String.format( "%15s processed.%s runtime per.1M.%s completed total.runtime remaining", "Location", processingUnitName, processingUnitName)); progressMeterDaemon.start(); }