@SuppressWarnings("static-access")
@Test
public void testLookupRoleTokenInCache() {

    Principal principal = SimplePrincipal.create("user_domain", "user",
            "auth_creds", PRINCIPAL_AUTHORITY);
    ZTSClient client = new ZTSClient("http://localhost:4080/", principal);
    String cacheKey = "p=user_domain.user;d=coretech;r=Role1";
    RoleToken roleToken = new RoleToken().setToken("role_token").setExpiryTime((System.currentTimeMillis() / 1000) + 3500L);
    client.ROLE_TOKEN_CACHE.put(cacheKey, roleToken);
    assertNotNull(client.lookupRoleTokenInCache(cacheKey, 3000, 4000, 900));
    Long expiryTime = roleToken.getExpiryTime();
    String token = "v=Z1;d=mydomain;r=admin;p=user_domain.user;h=localhost;a=f10bc905071a72d1;t=1448045776;e=" + expiryTime.toString() + ";k=0;i=10.11.12.13;s=pujvQuvaLa2jgE3k24bCw5Hm7AP9dUQkmkwNfX2bPhVXyhdRkOlbttF4exJm9V571sJXid6vsihgopCdxqW_qA--";
    ZTSClientTokenCacher.setRoleToken(token, "admin");
    cacheKey = client.getRoleTokenCacheKey("mydomain", "admin", null);
    assertEquals(cacheKey, "p=user_domain.user;d=mydomain;r=admin");
    assertNotNull(client.lookupRoleTokenInCache(cacheKey, 3000, 4000, 900));
    client.ROLE_TOKEN_CACHE.clear();
    client.close();
}