@Test
public void testAccessTokenExpired() {

    long now = System.currentTimeMillis() / 1000;
    // we allow clock skew of 60 seconds so we'll go
    // back 3600 + 61 to make our token expired
    AccessToken accessToken = createAccessToken(now - 3661);
    // now get the signed token
    PrivateKey privateKey = Crypto.loadPrivateKey(ecPrivateKey);
    String accessJws = accessToken.getSignedToken(privateKey, "eckey1", SignatureAlgorithm.ES256);
    assertNotNull(accessJws);
    // now verify our signed token
    final String oldConf = System.setProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF,
            "src/test/resources/athenz.conf");
    JwtsSigningKeyResolver resolver = new JwtsSigningKeyResolver(null, null);
    try {
        new AccessToken(accessJws, resolver);
        fail();
    } catch (Exception ex) {
        assertTrue(ex.getMessage().contains("expired"));
    }
    if (oldConf == null) {
        System.clearProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF);
    } else {
        System.setProperty(JwtsSigningKeyResolver.ZTS_PROP_ATHENZ_CONF, oldConf);
    }
}