@Test
public void testSingleBackoff() throws Exception {
ExponentialBackOffPolicy backOffPolicy = makeBackoffPolicy();
RetrySimulator simulator = new RetrySimulator(backOffPolicy, makeRetryPolicy());
RetrySimulation simulation = simulator.executeSimulation(1);
List<Long> sleeps = simulation.getLongestTotalSleepSequence().getSleeps();
System.out.println("Single trial of " + backOffPolicy + ": sleeps=" + sleeps);
assertEquals(MAX_RETRIES - 1, sleeps.size());
long initialInterval = backOffPolicy.getInitialInterval();
for (int i=0; i<sleeps.size(); i++) {
long expectedMaxValue = 2*(long) (initialInterval + initialInterval * Math.max(1, Math.pow(backOffPolicy.getMultiplier(), i)));