@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return timelockService.getFreshTimestamps(numTimestampsRequested); } }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return executeOnTimeLock(() -> delegate.getFreshTimestamps(numTimestampsRequested)); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return executeWithRecord(() -> timelockService.getFreshTimestamps(numTimestampsRequested)); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return checkAndUpdateLowerBound(() -> delegate.getFreshTimestamps(numTimestampsRequested), TimestampRange::getLowerBound, TimestampRange::getUpperBound); }
@Test public void getTimestampsDelegates() { int numTimestamps = 5; TimestampRange timestamps = TimestampRange.createInclusiveRange(1L, numTimestamps); when(timestampService.getFreshTimestamps(numTimestamps)).thenReturn(timestamps); assertThat(timelock.getFreshTimestamps(numTimestamps)).isEqualTo(timestamps); }
@Test public void getFreshTimestampsShouldFail() { TimestampRange timestampRange = TimestampRange.createInclusiveRange(1, 2); when(rawTimelockService.getFreshTimestamps(anyInt())).thenReturn(timestampRange); assertThrowsOnSecondCall(() -> timelockService.getFreshTimestamps(1)); }
@Test public void multipleFreshTimestampsRoutedToDecoratedService() { int numTimestamps = 42; decoratingService.getFreshTimestamps(numTimestamps); verify(decoratedTimestamps).getFreshTimestamps(numTimestamps); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return timelockService.getFreshTimestamps(numTimestampsRequested); } }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return executeOnTimeLock(() -> delegate.getFreshTimestamps(numTimestampsRequested)); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return checkAndUpdateLowerBound(() -> delegate.getFreshTimestamps(numTimestampsRequested), TimestampRange::getLowerBound, TimestampRange::getUpperBound); }
@Override public TimestampRange getFreshTimestamps(int numTimestampsRequested) { return executeWithRecord(() -> timelockService.getFreshTimestamps(numTimestampsRequested)); }