Skip to content

Commit d820508

Browse files
RomehRobWin
authored andcommitted
ReactiveX#259 FIXING code quality issues
1 parent 9dec4b6 commit d820508

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

resilience4j-retry/src/main/java/io/github/resilience4j/retry/internal/RetryImpl.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public boolean onResult(T result) {
9696
if (currentNumOfAttempts >= maxAttempts) {
9797
return false;
9898
} else {
99-
waitIntervalAfterResultFailure(currentNumOfAttempts, result);
99+
waitIntervalAfterFailure(currentNumOfAttempts, null);
100100
return true;
101101
}
102102
}
@@ -157,15 +157,6 @@ private void waitIntervalAfterFailure(int currentNumOfAttempts, Throwable throwa
157157
.getOrElseThrow(ex -> lastRuntimeException.get());
158158
}
159159

160-
private void waitIntervalAfterResultFailure(int currentNumOfAttempts, T result) {
161-
// wait interval until the next attempt should start
162-
long interval = intervalFunction.apply(numOfAttempts.get());
163-
publishRetryEvent(() -> new RetryOnRetryEvent(getName(), currentNumOfAttempts, null, interval));
164-
Try.run(() -> sleepFunction.accept(interval))
165-
.getOrElseThrow(ex -> lastRuntimeException.get());
166-
167-
}
168-
169160
}
170161

171162
/**

resilience4j-retry/src/test/java/io/github/resilience4j/retry/internal/AsyncRetryTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import javax.xml.ws.WebServiceException;
1515

1616
import org.assertj.core.api.Assertions;
17+
import org.junit.Assert;
1718
import org.junit.Before;
1819
import org.junit.Test;
1920
import org.mockito.BDDMockito;
@@ -75,6 +76,8 @@ public void shouldNotRetryWithThatResult() throws InterruptedException, Executio
7576
// Then the helloWorldService should be invoked 1 time
7677
BDDMockito.then(helloWorldService).should(Mockito.times(1)).returnHelloWorld();
7778
Assertions.assertThat(result).isEqualTo("Hello world");
79+
// for code quality scan , it does not not recognize assertJ do not why
80+
Assert.assertEquals(result, "Hello world");
7881
}
7982

8083
@Test
@@ -250,7 +253,7 @@ private void shouldCompleteFutureAfterAttemptsInCaseOfRetyOnResultAtAsyncStage(i
250253

251254
// Then the helloWorldService should be invoked n + 1 times
252255
BDDMockito.then(helloWorldService).should(Mockito.times(noOfAttempts)).returnHelloWorld();
253-
Assertions.assertThat(resultTry.isSuccess()).isTrue();
256+
Assert.assertTrue(resultTry.isSuccess());
254257

255258
}
256259

0 commit comments

Comments
 (0)