File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/test/java/com/auth0/jwt Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -97,15 +97,17 @@ public void shouldBoolean() throws Exception {
9797 @ Test
9898 public void shouldOptionsIat () throws Exception {
9999 HashMap <String , Object > claims = new HashMap <String , Object >();
100- String token = signer .sign (claims ,
101- new JWTSigner .Options ().setIssuedAt (true ));
100+ long before = System .currentTimeMillis ();
101+ String token = signer .sign (claims , new JWTSigner .Options ().setIssuedAt (true ));
102+ long after = System .currentTimeMillis ();
102103 Map <String , Object > decoded = verifier .verify (token );
104+
103105 assertEquals (decoded .size (), 1 );
104106 long iat = ((Number ) decoded .get ("iat" )).longValue ();
105- assertTrue (iat >= System . currentTimeMillis () / 1000l );
106- assertTrue (iat < System . currentTimeMillis () / 1000l + 10 );
107+ assertTrue (iat >= before / 1000l );
108+ assertTrue (iat <= after / 1000l );
107109 }
108-
110+
109111 @ Test
110112 public void shouldOptionsTimestamps () throws Exception {
111113 HashMap <String , Object > claims = new HashMap <String , Object >();
You can’t perform that action at this time.
0 commit comments