use of com.auth0.jwt.JWTExpiredException in project survey by markoniemi.
the class JwtTokenTest method verifyTokenWithExpiredToken.
@Test
public void verifyTokenWithExpiredToken() {
try {
User user = new User("username", "password", "email", Role.ROLE_USER);
Map<String, Object> payload = new HashMap<String, Object>();
payload.put("username", user.getUsername());
JwtToken token = new JwtToken(payload, 1);
Thread.sleep(1000);
token.verifyToken();
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e instanceof JWTExpiredException);
}
}
Aggregations