Timer { public synchronized void reset() { if (stopwatch.isRunning()) { stopwatch.stop(); } elapsedTime = 0; } @Inject  Timer(EventBus eventBus, @Assisted Object target); @VisibleForTesting  Timer(EventBus eventBus, Object target, Stopwatch stopwatch); synchronized void started(); synchronized void stop(); synchronized void reset(); void time(Runnable target); long getElapsedTime();  }
@Test public void testReset() { Timer timer = new MockTimer(eventBus, this); timer.started(); timer.reset(); assertEquals("Elapsed time was not reset", 0, timer.getElapsedTime(), 0); timer.started(); timer.stop(); assertEquals(WRONG_TIME_MSG, 1_000_000, timer.getElapsedTime()); timer.reset(); assertEquals("Elapsed time was not reset", 0, timer.getElapsedTime(), 0); }