@Test public void shouldValidateTokenWithLeewayCheck() { // given final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(JWTConstants.EXPIRATION, Instant.now().plusSeconds(7).getEpochSecond()); // when expirationChecker.check(jsonObject); }
@Test public void shouldFailForInvalidTokenValue() { // expect expectedException.expect(InvalidTokenException.class); // given final JsonObject jsonObject = new JsonObject(); // when expirationChecker.check(jsonObject); }
@Test public void shouldFailForExpiredToken() { // expect expectedException.expect(ExpiredTokenException.class); // given final JsonObject jsonObject = new JsonObject(); jsonObject.addProperty(JWTConstants.EXPIRATION, Instant.now().minusSeconds(7).getEpochSecond()); // when expirationChecker.check(jsonObject); }