@Test public void shouldNotRetryWhenItThrowErrorMono() { RetryConfig config = retryConfig(); Retry retry = Retry.of("testName", config); RetryOperator<String> retryOperator = RetryOperator.of(retry); given(helloWorldService.returnHelloWorld()) .willThrow(new Error("BAM!")); StepVerifier.create(Mono.fromCallable(helloWorldService::returnHelloWorld) .transformDeferred(retryOperator)) .expectSubscription() .expectError(Error.class) .verify(Duration.ofSeconds(1)); then(helloWorldService).should().returnHelloWorld(); Retry.Metrics metrics = retry.getMetrics(); assertThat(metrics.getNumberOfFailedCallsWithRetryAttempt()).isEqualTo(0); assertThat(metrics.getNumberOfFailedCallsWithoutRetryAttempt()).isEqualTo(0); }
public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); static RetryOperator<T> of(Retry retry); @Override Publisher<T> apply(Publisher<T> publisher); }
RetryOperator implements UnaryOperator<Publisher<T>> { public static <T> RetryOperator<T> of(Retry retry) { return new RetryOperator<>(retry); } private  RetryOperator(Retry retry); static RetryOperator<T> of(Retry retry); @Override Publisher<T> apply(Publisher<T> publisher);  }