QuantizedClock extends Clock { @Override public long getTime() { final long time = delegate.getTime(); return time - (time % periodInMS); } QuantizedClock(Clock delegate, long periodInMS); @Override long getTick(); @Override long getTime();  }
@Test public void getTime1() throws Exception { when(delegate.getTime()).thenReturn(1001L); assertEquals(1000, new QuantizedClock(delegate, 100).getTime()); }
@Test public void getTime2() throws Exception { when(delegate.getTime()).thenReturn(1999L); assertEquals(1900, new QuantizedClock(delegate, 100).getTime()); }
@Test public void getTime3() throws Exception { when(delegate.getTime()).thenReturn(1000L); assertEquals(1000, new QuantizedClock(delegate, 100).getTime()); }