### Question:
BackoffRetryManager implements RetryManager { public boolean hasExpired (Notification notification) { if (Instant.now().isAfter(notification.getExpirationTime())) { return true; } if (notification.getDeliveryAttempts() > maxAllowableRetriesForNotification(notification)) { return true; } return false; }  boolean hasExpired(Notification notification); int maxAllowableRetriesForNotification(Notification notification); int secondsBeforeRetry(Notification notification); static final int MAX_BACKOFF_DELAY; }### Answer:
@Test public void shouldntExpireValidNotification () { Notification n = Mockito.mock(Notification.class); Mockito.when(n.getExpirationTime()).thenReturn(Instant.MAX); Mockito.when(n.getDeliveryAttempts()).thenReturn(0); assertFalse(uut.hasExpired(n)); }
@Test public void shouldExpireTimedOutNotification () { Notification n = Mockito.mock(Notification.class); Mockito.when(n.getExpirationTime()).thenReturn(Instant.MIN); assertTrue(uut.hasExpired(n)); }
@Test public void shouldExpireTooManyRetires () { Notification n = Mockito.mock(Notification.class); Mockito.when(n.getExpirationTime()).thenReturn(Instant.MAX); Mockito.when(n.getDeliveryAttempts()).thenReturn(Integer.MAX_VALUE); assertTrue(uut.hasExpired(n)); }