### Question:
BoundedExponentialBackoff { public boolean applyNow() { final long remainingNanos = remainingNanosUntilDeadLine(); final long nextAmountOfNanosToSleep = nextAmountOfNanosToSleep(); final long actualSleep = Math.min(remainingNanos, nextAmountOfNanosToSleep); if (actualSleep <= 0) { return false; } timer.sleep(actualSleep); return true; } BoundedExponentialBackoff(Duration initialBackoffDuration, Duration maxRequestDuration); @VisibleForTesting  BoundedExponentialBackoff(
      Timer timer, Duration initialBackoffDuration, Duration maxRequestDuration); boolean applyNow();  }### Answer:
@Test public void simpleUsage() { assertThat(backoffUnderTest.applyNow(), is(true)); assertThat(fakeTime.now(), greaterThan(0L)); }
@Test public void timeoutExpired() { fakeTime.now = Duration.ofMinutes(1).toNanos(); assertThat(backoffUnderTest.applyNow(), is(false)); }
@Test @SuppressWarnings("StatementWithEmptyBody") public void totalNumberOfBackoffsIsEqualToTimeout() { while (backoffUnderTest.applyNow()) {} assertThat(fakeTime.now(), is(Duration.ofMinutes(1).toNanos())); }