diff --git a/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java b/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java index 25b2669a..9f15adea 100644 --- a/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java +++ b/src/test/java/org/springframework/retry/annotation/EnableRetryWithBackoffTests.java @@ -52,7 +52,7 @@ public void type() { RandomService service = context.getBean(RandomService.class); service.service(); List periods = context.getBean(PeriodSleeper.class).getPeriods(); - assertThat(periods.get(0) > 1000).describedAs("Wrong periods: %s" + periods.toString()).isTrue(); + assertThat(periods.get(0)).describedAs("Wrong periods: %s" + periods).isGreaterThan(1000); assertThat(service.getCount()).isEqualTo(3); context.close(); } @@ -76,9 +76,7 @@ public void randomExponential() { List periods = context.getBean(PeriodSleeper.class).getPeriods(); assertThat(context.getBean(PeriodSleeper.class).getPeriods().toString()).isNotEqualTo("[1000, 1100]"); assertThat(periods.get(0)).describedAs("Wrong periods: %s" + periods).isGreaterThanOrEqualTo(1000); - assertThat(periods.get(1)).describedAs("Wrong periods: %s" + periods) - .isGreaterThanOrEqualTo(1100) - .isLessThanOrEqualTo(1210); + assertThat(periods.get(1)).describedAs("Wrong periods: %s" + periods).isBetween(1100L, 1210L); context.close(); } @@ -90,9 +88,8 @@ public void randomExponentialExpression() { assertThat(service.getCount()).isEqualTo(3); List periods = context.getBean(PeriodSleeper.class).getPeriods(); assertThat(context.getBean(PeriodSleeper.class).getPeriods().toString()).isNotEqualTo("[1000, 1100]"); - assertThat(periods.get(0) > 1000).describedAs("Wrong periods: %s" + periods.toString()).isTrue(); - assertThat(periods.get(1) > 1100 && periods.get(1) < 1210).describedAs("Wrong periods: %s" + periods.toString()) - .isTrue(); + assertThat(periods.get(0)).describedAs("Wrong periods: %s" + periods).isGreaterThanOrEqualTo(1000); + assertThat(periods.get(1)).describedAs("Wrong periods: %s" + periods).isBetween(1100L, 1210L); context.close(); } @@ -102,7 +99,7 @@ public void randomExponentialExpression() { protected static class TestConfiguration { @Bean - public PeriodSleeper sleper() { + public PeriodSleeper sleeper() { return new PeriodSleeper(); }