TickClock implements Clock { @Override public long currentTimeMicroseconds() { return ((System.nanoTime() - baseTickNanos) / 1000) + baseEpochMicros; } TickClock(long baseEpochMicros, long baseTickNanos); @Override long currentTimeMicroseconds(); @Override String toString();  }
@Test public void relativeTimestamp_incrementsAccordingToNanoTick() { mockStatic(System.class); TickClock clock = new TickClock(1000L , 0L ); when(System.nanoTime()).thenReturn(1000L); assertThat(clock.currentTimeMicroseconds()).isEqualTo(1001L); }