AccessTokenResponseCacheEntry { AccessTokenResponseCacheEntry(AccessTokenResponse accessTokenResponse) { this.accessTokenResponse = accessTokenResponse; this.expiryTime = System.currentTimeMillis() / 1000 + accessTokenResponse.getExpires_in(); this.serverExpirySecs = accessTokenResponse.getExpires_in(); } AccessTokenResponseCacheEntry(AccessTokenResponse accessTokenResponse); boolean isExpired(long expirySeconds); AccessTokenResponse accessTokenResponse();  }
@Test public void testAccessTokenResponseCacheEntry() throws InterruptedException { AccessTokenResponse tokenResponse = new AccessTokenResponse(); tokenResponse.setExpires_in(100); tokenResponse.setScope("scope"); tokenResponse.setRefresh_token("refresh"); tokenResponse.setToken_type("Bearer"); tokenResponse.setId_token("id"); tokenResponse.setAccess_token("access"); AccessTokenResponseCacheEntry entry = new AccessTokenResponseCacheEntry(tokenResponse); Thread.sleep(1000); AccessTokenResponse response = entry.accessTokenResponse(); assertEquals("scope", response.getScope()); assertEquals("refresh", response.getRefresh_token()); assertEquals("Bearer", response.getToken_type()); assertEquals("id", response.getId_token()); assertEquals("access", response.getAccess_token()); int expiry = response.getExpires_in(); assertTrue(expiry < 100, response.getExpires_in().toString()); }