From a63ab02e7e2dbae0d6479f6be4307a67afc0aa1a Mon Sep 17 00:00:00 2001 From: Scott Leberknight <174812+sleberknight@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:10:50 -0400 Subject: [PATCH] Code cleanup --- .../java/org/kiwiproject/retry/AttemptTimeLimiters.java | 1 - src/test/java/org/kiwiproject/retry/AttemptTest.java | 6 +++--- src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/kiwiproject/retry/AttemptTimeLimiters.java b/src/main/java/org/kiwiproject/retry/AttemptTimeLimiters.java index 125ea73..868e1d5 100644 --- a/src/main/java/org/kiwiproject/retry/AttemptTimeLimiters.java +++ b/src/main/java/org/kiwiproject/retry/AttemptTimeLimiters.java @@ -65,7 +65,6 @@ public T call(Callable callable) throws Exception { } // Suppress API warnings about TimeLimiter in Guava which has been there since version 1.0 - @SuppressWarnings("UnstableApiUsage") @Immutable private static final class FixedAttemptTimeLimit implements AttemptTimeLimiter { diff --git a/src/test/java/org/kiwiproject/retry/AttemptTest.java b/src/test/java/org/kiwiproject/retry/AttemptTest.java index 05af798..8ad4829 100644 --- a/src/test/java/org/kiwiproject/retry/AttemptTest.java +++ b/src/test/java/org/kiwiproject/retry/AttemptTest.java @@ -35,7 +35,7 @@ void shouldCreateWithResult() { () -> assertThat(attempt.hasResult()).isTrue(), () -> assertThat(attempt.hasException()).isFalse(), () -> assertThat(attempt.getResult()).isEqualTo(result), - () -> assertThatIllegalStateException().isThrownBy(() -> attempt.getException()), + () -> assertThatIllegalStateException().isThrownBy(attempt::getException), () -> assertThat(attempt.getAttemptNumber()).isEqualTo(attemptNumber), () -> assertThat(attempt.getDelaySinceFirstAttempt()).isEqualTo(delaySinceFirstAttempt) ); @@ -49,7 +49,7 @@ void shouldAllowNullResult() { () -> assertThat(attempt.hasResult()).isTrue(), () -> assertThat(attempt.hasException()).isFalse(), () -> assertThat(attempt.getResult()).isNull(), - () -> assertThatIllegalStateException().isThrownBy(() -> attempt.getException()), + () -> assertThatIllegalStateException().isThrownBy(attempt::getException), () -> assertThat(attempt.getAttemptNumber()).isEqualTo(attemptNumber), () -> assertThat(attempt.getDelaySinceFirstAttempt()).isEqualTo(delaySinceFirstAttempt) ); @@ -63,7 +63,7 @@ void shouldCreateWithException() { assertAll( () -> assertThat(attempt.hasResult()).isFalse(), () -> assertThat(attempt.hasException()).isTrue(), - () -> assertThatIllegalStateException().isThrownBy(() -> attempt.getResult()), + () -> assertThatIllegalStateException().isThrownBy(attempt::getResult), () -> assertThat(attempt.getException()).isSameAs(exception), () -> assertThat(attempt.getAttemptNumber()).isEqualTo(attemptNumber), () -> assertThat(attempt.getDelaySinceFirstAttempt()).isEqualTo(delaySinceFirstAttempt) diff --git a/src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java b/src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java index 5983b66..67fa934 100644 --- a/src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java +++ b/src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java @@ -521,7 +521,7 @@ private static Callable callableCountingDownAlwaysNull(final CountDownL private static Callable callableReturningNullUntil5Attempts() { return new Callable<>() { - AtomicInteger count = new AtomicInteger(); + final AtomicInteger count = new AtomicInteger(); @Override public Boolean call() { @@ -543,7 +543,7 @@ private static Callable callableThrowingIOExceptionUntil5Attempts() { private static Callable callableThrowingExceptionUntil5Attempts(E e) { return new Callable<>() { - AtomicInteger count = new AtomicInteger(); + final AtomicInteger count = new AtomicInteger(); @Override public Boolean call() throws E { @@ -557,7 +557,7 @@ public Boolean call() throws E { private static Callable callableThrowingOrReturningNullUntil5Attempts() { return new Callable<>() { - AtomicInteger counter = new AtomicInteger(); + final AtomicInteger counter = new AtomicInteger(); @Override public Boolean call() throws IOException {