Jwt implements AccessToken { public boolean isExpired() { long currentTimeStamp = new Date().getTime() / 1000; return currentTimeStamp >= bodyContent.getExpiresAt(); } Jwt(JwtHeaderContent headerContent, JwtBodyContent bodyContent);  Jwt(JwtHeaderContent headerContent, JwtBodyContent bodyContent, byte[] signatureData);  Jwt(String jwtToken); @Override boolean equals(Object obj); JwtBodyContent getBodyContent(); JwtHeaderContent getHeaderContent(); @Override String getIdentity(); byte[] getSignatureData(); @Override int hashCode(); boolean isExpired(); boolean isExpired(Date lifeTimePredefined); @Override String stringRepresentation();  }
@Test public void future_expire() throws CryptoException, InterruptedException { JwtGenerator generator = fake.getJwtGeneratorFiveSeconds(); Jwt jwt = generator.generateToken(this.identity); assertNotNull(jwt); assertFalse(jwt.isExpired()); assertTrue(jwt.isExpired(new Date(System.currentTimeMillis() + FUTURE_TIME_EXPIRATION))); Thread.sleep(FUTURE_TIME_EXPIRATION); assertTrue(jwt.isExpired()); }