From e6124a7e4d21b544c60b2119d5f05dc16df9ca9e Mon Sep 17 00:00:00 2001 From: Jonathan Halterman Date: Sun, 3 Sep 2023 15:11:41 -0700 Subject: [PATCH] Fix unit test that was quietly failing --- core/src/test/java/dev/failsafe/ListenersTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/dev/failsafe/ListenersTest.java b/core/src/test/java/dev/failsafe/ListenersTest.java index 81d034e6..b15b9476 100644 --- a/core/src/test/java/dev/failsafe/ListenersTest.java +++ b/core/src/test/java/dev/failsafe/ListenersTest.java @@ -483,15 +483,17 @@ public void testFailingFallbackAsync() throws Throwable { } public void shouldGetElapsedAttemptTime() { + Recorder recorder = new Recorder(); RetryPolicy 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(); } /**