Skip to content

Commit

Permalink
Code cleanup (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
sleberknight authored Sep 1, 2024
1 parent def2ed0 commit 27b535f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public <T> T call(Callable<T> 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 {

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/kiwiproject/retry/AttemptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand All @@ -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)
);
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/kiwiproject/retry/RetryerBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private static Callable<Boolean> callableCountingDownAlwaysNull(final CountDownL

private static Callable<Boolean> callableReturningNullUntil5Attempts() {
return new Callable<>() {
AtomicInteger count = new AtomicInteger();
final AtomicInteger count = new AtomicInteger();

@Override
public Boolean call() {
Expand All @@ -543,7 +543,7 @@ private static Callable<Boolean> callableThrowingIOExceptionUntil5Attempts() {

private static <E extends Exception> Callable<Boolean> callableThrowingExceptionUntil5Attempts(E e) {
return new Callable<>() {
AtomicInteger count = new AtomicInteger();
final AtomicInteger count = new AtomicInteger();

@Override
public Boolean call() throws E {
Expand All @@ -557,7 +557,7 @@ public Boolean call() throws E {

private static Callable<Boolean> callableThrowingOrReturningNullUntil5Attempts() {
return new Callable<>() {
AtomicInteger counter = new AtomicInteger();
final AtomicInteger counter = new AtomicInteger();

@Override
public Boolean call() throws IOException {
Expand Down

0 comments on commit 27b535f

Please sign in to comment.