### Question:
NetworkStretcher { public Duration getRestInterval(Duration elapsedTime){ Duration restInterval = currentPeriod.minus(elapsedTime); if (restInterval.toMillis() < initialPollInterval.toMillis()){ restInterval = initialPollInterval; } return restInterval; }  void modifyIterationTimeouts(); Duration getRestInterval(Duration elapsedTime); void modifyDecreasedPeriod();  }### Answer:
@Test public void testRestInterval(){ NetworkStretcher ns = NetworkStretcher.builder() .currentPeriod(Duration.ofSeconds(2)) .initialPollInterval(Duration.ofSeconds(1)) .build(); Duration elapsedTime1 = Duration.ofMillis(500); Duration restInterval = ns.getRestInterval(elapsedTime1); assertThat(restInterval.toMillis()).isEqualTo(1500); Duration elapsedTime2 = Duration.ofMillis(800); restInterval = ns.getRestInterval(elapsedTime2); assertThat(restInterval.toMillis()).isEqualTo(1200); Duration elapsedTime3 = Duration.ofMillis(1200); restInterval = ns.getRestInterval(elapsedTime3); assertThat(restInterval.toMillis()).isEqualTo(1000); }