@Test
public void testGetTenantDomains() {

    ZTSRDLClientMock ztsClientMock = new ZTSRDLClientMock();
    List<String> tenantDomains = new ArrayList<>();
    tenantDomains.add("iaas.athenz");
    tenantDomains.add("coretech.storage");
    ztsClientMock.setTenantDomains(tenantDomains);
    Principal principal = SimplePrincipal.create("user_domain", "user",
            "v=S1;d=user_domain;n=user;s=sig", PRINCIPAL_AUTHORITY);
    ZTSClient client = new ZTSClient("http://localhost:4080", principal);
    client.setZTSRDLGeneratedClient(ztsClientMock);
    TenantDomains doms = client.getTenantDomains("provider", "user", "admin", "storage");
    assertNotNull(doms);
    assertTrue(doms.getTenantDomainNames().contains("iaas.athenz"));
    assertTrue(doms.getTenantDomainNames().contains("coretech.storage"));
    try {
        client.getTenantDomains("unknown", "user", "admin", "storage");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 404);
    } catch (Exception ex) {
        fail();
    }
    client.close();
}