@Test public void worksOnRollover() {

    mockStatic(System.class);
    when(System.nanoTime()).thenReturn(-NANOS_PER_SECOND);
    Reservoir reservoir = new Reservoir(2);
    assertTrue(reservoir.take());
    when(System.nanoTime()).thenReturn(-NANOS_PER_SECOND / 2);
    assertTrue(reservoir.take()); // second request
    when(System.nanoTime()).thenReturn(-NANOS_PER_SECOND / 4);
    assertFalse(reservoir.take());
    when(System.nanoTime()).thenReturn(0L); // reset
    assertTrue(reservoir.take());
}