### Question:
DelayCalculator { public long getExponentialDelayMillis(int attemptsLeft, BackupFlags backupFlags) { int maxWaitingTimeBtwUpload = backupFlags.getMaxWaitingTimeBtwUpload(); if (attemptsLeft < 1) { return backupFlags.getMinUploadDelay(); } if (attemptsLeft > backupFlags.getAttemptsAmount()) { return maxWaitingTimeBtwUpload; } long delay = (long) (backupFlags.getMinUploadDelay() + (Math.round(Math.pow(DELAY_CALCULATION_BASE, backupFlags.getAttemptsAmount() - attemptsLeft + 1)) - DELAY_CALCULATION_BASE) * MILS_MUL); return (delay >= maxWaitingTimeBtwUpload) ? maxWaitingTimeBtwUpload : delay; }  long getExponentialDelayMillis(int attemptsLeft, BackupFlags backupFlags);  }### Answer:
@Test public void delayOnFirstTry() { assertThat(calc.getExponentialDelayMillis(5, backupFlags)).isEqualTo(100L); }
@Test public void delayOnLastTry() { assertThat(calc.getExponentialDelayMillis(1, backupFlags)).isEqualTo(5000L); }
@Test public void delayOnIntermediateTry() { assertThat(calc.getExponentialDelayMillis(4, backupFlags)).isEqualTo(2100L); }
@Test public void delayWithNegativeValue() { assertThat(calc.getExponentialDelayMillis(-3, backupFlags)).isEqualTo(100L); }
@Test public void delayWithInvavidAttemptValue() { assertThat(calc.getExponentialDelayMillis(20, backupFlags)).isEqualTo(5000L); }