### Question:
AuthnRequestIssueInstantValidator { public boolean isValid(DateTime issueInstant) { final Duration authnRequestValidityDuration = samlAuthnRequestValidityDurationConfiguration.getAuthnRequestValidityDuration(); return !issueInstant.isBefore(DateTime.now().minus(authnRequestValidityDuration.toMilliseconds())); } @Inject  AuthnRequestIssueInstantValidator(SamlAuthnRequestValidityDurationConfiguration samlAuthnRequestValidityDurationConfiguration); boolean isValid(DateTime issueInstant);  }### Answer:
@Test public void validate_shouldReturnFalseIfIssueInstantMoreThan5MinutesAgo() { DateTimeFreezer.freezeTime(); DateTime issueInstant = DateTime.now().minusMinutes(AUTHN_REQUEST_VALIDITY_MINS).minusSeconds(1); boolean validity = authnRequestIssueInstantValidator.isValid(issueInstant); assertThat(validity).isEqualTo(false); }
@Test public void validate_shouldReturnTrueIfIssueInstant5MinsAgo() { DateTimeFreezer.freezeTime(); DateTime issueInstant = DateTime.now().minusMinutes(AUTHN_REQUEST_VALIDITY_MINS); boolean validity = authnRequestIssueInstantValidator.isValid(issueInstant); assertThat(validity).isEqualTo(true); }
@Test public void validate_shouldReturnTrueIfIssueInstantLessThan5MinsAgo() { DateTimeFreezer.freezeTime(); DateTime issueInstant = DateTime.now().minusMinutes(AUTHN_REQUEST_VALIDITY_MINS).plusSeconds(1); boolean validity = authnRequestIssueInstantValidator.isValid(issueInstant); assertThat(validity).isEqualTo(true); }