@Test
public void testGetRoleToken() {

    Principal principal = SimplePrincipal.create("user_domain", "user",
            "auth_creds", PRINCIPAL_AUTHORITY);
    ZTSRDLClientMock ztsClientMock = new ZTSRDLClientMock();
    ztsClientMock.setRoleName("role1");
    ZTSClient client = new ZTSClient("http://localhost:4080", principal);
    client.setZTSRDLGeneratedClient(ztsClientMock);
    RoleToken roleToken = client.getRoleToken("coretech");
    assertNotNull(roleToken);
    com.yahoo.athenz.auth.token.RoleToken token = new com.yahoo.athenz.auth.token.RoleToken(roleToken.getToken());
    assertEquals(token.getDomain(), "coretech");
    assertEquals(1, token.getRoles().size());
    assertTrue(token.getRoles().contains("role1"));
    // now we're going to get a token again and this time we should get back
    // from our cache thus the same exact one
    RoleToken roleToken2 = client.getRoleToken("coretech");
    assertEquals(roleToken2.getToken(), roleToken.getToken());
    // now we're going to use the full API to request the token with ignoring from the cache
    // and we should get back a new token
    roleToken2 = client.getRoleToken("coretech", null, null, null, true, null);
    assertNotEquals(roleToken2.getToken(), roleToken.getToken());
    client.close();
}