Skip to content

Commit

Permalink
Fix unit test that was quietly failing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalterman committed Sep 3, 2023
1 parent 3ad8e8b commit e6124a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/test/java/dev/failsafe/ListenersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,17 @@ public void testFailingFallbackAsync() throws Throwable {
}

public void shouldGetElapsedAttemptTime() {
Recorder recorder = new Recorder();
RetryPolicy<Object> retryPolicy = RetryPolicy.builder()
.withMaxAttempts(3)
.handleResult(false)
.onRetry(e -> assertTrue(e.getElapsedAttemptTime().toMillis() >= 90))
.onRetryScheduled(e -> recorder.assertTrue(e.getElapsedAttemptTime().toMillis() >= 90))
.build();
Failsafe.with(retryPolicy).get(() -> {
Thread.sleep(100);
return false;
});
recorder.throwFailures();
}

/**
Expand Down

0 comments on commit e6124a7

Please sign in to comment.