@Test public void testExceptionWait() { WaitStrategy exceptionWait = WaitStrategies.exceptionWait( RuntimeException.class, zeroSleepFunction()); assertEquals(0L, exceptionWait.computeSleepTime(failedAttempt(42, 7227))); WaitStrategy oneMinuteWait = WaitStrategies.exceptionWait(RuntimeException.class, oneMinuteSleepFunction()); assertEquals(3600 * 1000L, oneMinuteWait.computeSleepTime(failedAttempt(42, 7227))); WaitStrategy noMatchRetryAfterWait = WaitStrategies.exceptionWait(RetryAfterException.class, customSleepFunction()); assertEquals(0L, noMatchRetryAfterWait.computeSleepTime(failedAttempt(42, 7227))); WaitStrategy retryAfterWait = WaitStrategies.exceptionWait(RetryAfterException.class, customSleepFunction()); Attempt<Boolean> failedAttempt = new Attempt<>( new RetryAfterException(), 42, 7227L); assertEquals(29L, retryAfterWait.computeSleepTime(failedAttempt)); }