TimestampCorroboratingTimelockService implements AutoDelegate_TimelockService { @Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return checkAndUpdateLowerBound(() -> delegate.getFreshTimestamps(numTimestampsRequested), TimestampRange::getLowerBound, TimestampRange::getUpperBound, OperationType.TIMESTAMP); } private  TimestampCorroboratingTimelockService(TimelockService delegate); static TimelockService create(TimelockService delegate); @Override TimelockService delegate(); @Override long getFreshTimestamp(); @Override TimestampRange getFreshTimestamps(int numTimestampsRequested); @Override List<StartIdentifiedAtlasDbTransactionResponse> startIdentifiedAtlasDbTransactionBatch(int count);  }
@Test public void getFreshTimestampsShouldFail() { TimestampRange timestampRange = TimestampRange.createInclusiveRange(1, 2); when(rawTimelockService.getFreshTimestamps(anyInt())).thenReturn(timestampRange); assertThrowsOnSecondCall(() -> timelockService.getFreshTimestamps(1)); }