Skip to content

Commit

Permalink
ReactiveX#259 FIXING code quality issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Romeh authored and RobWin committed Nov 9, 2018
1 parent 9dec4b6 commit d820508
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public boolean onResult(T result) {
if (currentNumOfAttempts >= maxAttempts) {
return false;
} else {
waitIntervalAfterResultFailure(currentNumOfAttempts, result);
waitIntervalAfterFailure(currentNumOfAttempts, null);
return true;
}
}
Expand Down Expand Up @@ -157,15 +157,6 @@ private void waitIntervalAfterFailure(int currentNumOfAttempts, Throwable throwa
.getOrElseThrow(ex -> lastRuntimeException.get());
}

private void waitIntervalAfterResultFailure(int currentNumOfAttempts, T result) {
// wait interval until the next attempt should start
long interval = intervalFunction.apply(numOfAttempts.get());
publishRetryEvent(() -> new RetryOnRetryEvent(getName(), currentNumOfAttempts, null, interval));
Try.run(() -> sleepFunction.accept(interval))
.getOrElseThrow(ex -> lastRuntimeException.get());

}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.xml.ws.WebServiceException;

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

@Test
Expand Down Expand Up @@ -250,7 +253,7 @@ private void shouldCompleteFutureAfterAttemptsInCaseOfRetyOnResultAtAsyncStage(i

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

}

Expand Down

0 comments on commit d820508

Please sign in to comment.