@Test
public void testValidateExpiration() {

    final DefaultOAuthJwtAccessTokenValidator validator = new DefaultOAuthJwtAccessTokenValidator(this.trustedIssuer, this.requiredAudiences, this.requiredScopes, this.authorizedClientIds);
    final OAuthJwtAccessToken mock = Mockito.spy(baseJwt);
    Mockito.doReturn("trustedIssuer").when(mock).getIssuer();
    Mockito.doReturn(Arrays.asList("aud_1", "aud_2")).when(mock).getAudiences();
    Mockito.doReturn(Arrays.asList("scope_1", "scope_2")).when(mock).getScopes();
    // zero exp
    Mockito.doReturn(0L).when(mock).getExpiration();
    assertThrowable.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validate(mock);
        }
    }, "exp is empty");
    // -ve exp
    Mockito.doReturn(-1L).when(mock).getExpiration();
    assertThrowable.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validate(mock);
        }
    }, "exp is empty");
    // +ve exp
    Mockito.doReturn(1L).when(mock).getExpiration();
    assertDoesNotThrow.accept(new ThrowingRunnable() {
        public void run() throws Throwable {
            validator.validate(mock);
        }
    });
}