@Test
public void testStaleAndExpired() throws Exception {

  long expiration = HeaderCacheElement.TOKEN_STALENESS_MS + 1;
  initialize(expiration);
  Assert.assertEquals(CacheState.Good, underTest.getHeaderCache().getCacheState());
  long startTime = 2L;
  setTimeInMillieconds(startTime);
  Assert.assertEquals(CacheState.Stale, underTest.getHeaderCache().getCacheState());
  long expiredStaleDiff =
      HeaderCacheElement.TOKEN_STALENESS_MS - HeaderCacheElement.TOKEN_EXPIRES_MS;
  setTimeInMillieconds(startTime + expiredStaleDiff);
  Assert.assertEquals(CacheState.Expired, underTest.getHeaderCache().getCacheState());
}