()
| 302 | } |
| 303 | |
| 304 | @Test |
| 305 | public void shouldGetIssuedAt() { |
| 306 | long seconds = 1477592; |
| 307 | Clock clock = Clock.fixed(Instant.ofEpochSecond(seconds), ZoneId.of("UTC")); |
| 308 | |
| 309 | String token = "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE0Nzc1OTJ9.5o1CKlLFjKKcddZzoarQ37pq7qZqNPav3sdZ_bsZaD4"; |
| 310 | JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); |
| 311 | DecodedJWT jwt = verification |
| 312 | .build(clock) |
| 313 | .verify(token); |
| 314 | |
| 315 | assertThat(jwt, is(notNullValue())); |
| 316 | assertThat(jwt.getIssuedAt(), is(equalTo(new Date(seconds * 1000)))); |
| 317 | assertThat(jwt.getIssuedAtAsInstant(), is(equalTo(Instant.ofEpochSecond(seconds)))); |
| 318 | } |
| 319 | |
| 320 | @Test |
| 321 | public void shouldGetId() { |
nothing calls this directly
no test coverage detected