@Test
  public void testReset() {
    TestTimeService ts = new TestTimeService();
    final NanoTimer timer = new NanoTimer(ts);
    final long nanosOne = ts.getTime();

    ts.incTime();

    assertEquals(timer.getConstructionTime(), timer.getLastResetTime());
    assertTrue(timer.getTimeSinceConstruction() <= timer.getTimeSinceReset());

    final long nanosTwo = ts.getTime();
    final long resetOne = timer.reset();

    assertTrue(resetOne >= nanosTwo - nanosOne);
    assertFalse(timer.getConstructionTime() == timer.getLastResetTime());

    final long nanosThree = ts.getTime();

    ts.incTime();

    assertTrue(timer.getLastResetTime() >= nanosTwo);
    assertTrue(timer.getTimeSinceReset() < timer.getTimeSinceConstruction());
    assertTrue(timer.getLastResetTime() <= nanosThree);
    assertTrue(timer.getTimeSinceReset() <= ts.getTime() - timer.getLastResetTime());

    final long nanosFour = ts.getTime();
    final long resetTwo = timer.reset();

    assertTrue(resetTwo >= nanosFour - nanosThree);

    ts.incTime();

    assertTrue(timer.getLastResetTime() >= nanosFour);
    assertTrue(timer.getTimeSinceReset() < timer.getTimeSinceConstruction());
    assertTrue(timer.getTimeSinceReset() <= ts.getTime() - timer.getLastResetTime());
  }
Unit tests for NanoTimer.

@since GemFire 7.0
geode-core/src/test/java/org/apache/geode/internal/NanoTimerJUnitTest.java