@Override
    public RetryStrategy getNextRetryStrategy() {
        int nextRemainingRetries = remainingRetries - 1;
        Preconditions.checkState(
                nextRemainingRetries >= 0, "The number of remaining retries must not be negative");
        long nextRetryDelayMillis =
                Math.min(currentRetryDelay.plus(increment).toMillis(), maxRetryDelay.toMillis());
        return new IncrementalDelayRetryStrategy(
                nextRemainingRetries,
                Duration.ofMillis(nextRetryDelayMillis),
                increment,
                maxRetryDelay);
    }
@Test
    void testRetryFailure() {
        assertThatThrownBy(
                        () ->
                                new IncrementalDelayRetryStrategy(
                                                0,
                                                Duration.ofMillis(20L),
                                                Duration.ofMillis(5L),
                                                Duration.ofMillis(20L))
                                        .getNextRetryStrategy())
                .isInstanceOf(IllegalStateException.class);
    }