107: ensured exception message printed UTC times correctly

This commit is contained in:
Les Hazlewood 2016-09-11 14:04:20 -07:00
parent 0f63ec8012
commit 1974069561
2 changed files with 7 additions and 1 deletions

View File

@ -56,7 +56,7 @@ import java.util.Map;
public class DefaultJwtParser implements JwtParser {
//don't need millis since JWT date fields are only second granularity:
private static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
private static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
private ObjectMapper objectMapper = new ObjectMapper();

View File

@ -175,6 +175,9 @@ class JwtParserTest {
fail()
} catch (ExpiredJwtException e) {
assertTrue e.getMessage().startsWith('JWT expired at ')
//https://github.com/jwtk/jjwt/issues/107 :
assertTrue e.getMessage().endsWith('Z')
}
}
@ -190,6 +193,9 @@ class JwtParserTest {
fail()
} catch (PrematureJwtException e) {
assertTrue e.getMessage().startsWith('JWT must not be accepted before ')
//https://github.com/jwtk/jjwt/issues/107 :
assertTrue e.getMessage().endsWith('Z')
}
}