Fix flaky test

Issue gh-15735
This commit is contained in:
Steve Riesenberg 2024-10-11 10:56:53 -05:00
parent da2561f9ad
commit af2b84246b
No known key found for this signature in database
GPG Key ID: 3D0169B18AB8F0A9

View File

@ -161,8 +161,8 @@ class JdbcOneTimeTokenServiceTests {
@Test
void cleanupExpiredTokens() {
Clock clock = mock(Clock.class);
Instant fiveMinutesAgo = Instant.now().minus(Duration.ofMinutes(5));
given(clock.instant()).willReturn(fiveMinutesAgo);
Instant tenMinutesAgo = Instant.now().minus(Duration.ofMinutes(10));
given(clock.instant()).willReturn(tenMinutesAgo);
this.oneTimeTokenService.setClock(clock);
OneTimeToken token1 = this.oneTimeTokenService.generate(new GenerateOneTimeTokenRequest(USERNAME));
OneTimeToken token2 = this.oneTimeTokenService.generate(new GenerateOneTimeTokenRequest(USERNAME));