### Question:
TimeLimitedBase { public boolean shouldExtend(Duration gracePeriod) { return !isExpired() && renewable && now().plus(gracePeriod).isAfter(getExpireInstant()); } TimeLimitedBase(boolean renewable, long leaseDurationSecs);  TimeLimitedBase(TimeLimitedBase other); boolean isExpired(); boolean shouldExtend(Duration gracePeriod); Instant getExpireInstant(); Date getExpiredDate(); boolean expiresSoon(Duration gracePeriod); String info(); void leaseDurationSanityCheck(String nickname, Duration gracePeriod); public boolean renewable; public long leaseDurationSecs; }### Answer:
@Test public void shouldExtend() { assertFalse(newTimeLimitedBase(true, 80, EPOCH, EPOCH.plusSeconds(60)).shouldExtend(ofSeconds(10)), "before grace period"); assertTrue(newTimeLimitedBase(true, 80, EPOCH, EPOCH.plusSeconds(71)).shouldExtend(ofSeconds(10)), "within grace period"); assertFalse(newTimeLimitedBase(true, 80, EPOCH, EPOCH.plusSeconds(82)).shouldExtend(ofSeconds(10)), "expired"); assertFalse(newTimeLimitedBase(false, 80, EPOCH, EPOCH.plusSeconds(71)).shouldExtend(ofSeconds(10)), "within grace period, but not renewable"); }