use of org.springframework.retry.backoff.BackOffContext in project molgenis by molgenis.
the class ConnectionRetryConfigTest method testBackOffPolicyIsExponential.
@Test
public void testBackOffPolicyIsExponential() {
List<Long> sleeps = newArrayList();
ExponentialBackOffPolicy fakeBackOff = this.backOffPolicy.withSleeper(sleeps::add);
BackOffContext context = fakeBackOff.start(null);
for (int i = 0; i < 11; i++) {
fakeBackOff.backOff(context);
}
assertEquals(sleeps, Arrays.asList(1000L, 2000L, 4000L, 8000L, 16000L, 32000L, 64000L, 128000L, 256000L, 300000L, 300000L));
}
Aggregations