@Test public void waitIntervalOverTenMillisShouldSucceed() { RetryConfig config = RetryConfig.custom().waitDuration(Duration.ofSeconds(10)).build(); Assertions.assertThat(config).isNotNull(); }
@Test public void waitIntervalOfTenMillisShouldSucceed() { RetryConfig config = RetryConfig.custom().waitDuration(Duration.ofMillis(10)).build(); Assertions.assertThat(config).isNotNull(); }
@Test public void canBuildRetryFromRegistryWithConfigSupplier() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); AsyncRetry retry = retryRegistry.retry("testName", () -> config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); }
retry = retryRegistry.retry(name, RetryConfig.custom() .maxAttempts(retryConfig.getMaxAttempts()) .waitDuration(Duration.ofMillis(retryConfig.getWaitDurationInMillis())) .build());
retry = retryRegistry.retry(name, RetryConfig.custom() .maxAttempts(retryConfig.getMaxAttempts()) .waitDuration(Duration.ofMillis(retryConfig.getWaitDurationInMillis())) .build());
@Test(expected = IllegalArgumentException.class) public void waitIntervalUnderTenMillisShouldFail() { RetryConfig.custom().waitDuration(Duration.ofMillis(5)).build(); }
@Test(expected = IllegalArgumentException.class) public void zeroWaitIntervalShouldFail() { RetryConfig.custom().waitDuration(Duration.ofMillis(0)).build(); }
@Test public void canBuildRetryRegistryWithConfig() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); retryRegistry = AsyncRetryRegistry.of(config); AsyncRetry retry = retryRegistry.retry("testName", () -> config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); } }
@Test public void canBuildRetryRegistryWithConfig() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); retryRegistry = RetryRegistry.of(config); Retry retry = retryRegistry.retry("testName", () -> config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); } }
@Test public void canBuildRetryFromRegistryWithConfig() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); AsyncRetry retry = retryRegistry.retry("testName", config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); }
@Test public void canBuildRetryFromRegistryWithConfigSupplier() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); Retry retry = retryRegistry.retry("testName", () -> config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); }
@Test public void canBuildRetryFromRegistryWithConfig() { RetryConfig config = RetryConfig.custom().maxAttempts(1000).waitDuration(Duration.ofSeconds(300)).build(); Retry retry = retryRegistry.retry("testName", config); Assertions.assertThat(retry).isNotNull(); Assertions.assertThat(retryRegistry.getAllRetries()).hasSize(1); }