@Test
public void testPutTenant() {

    TopLevelDomain dom1 = createTopLevelDomainObject("providerdomain",
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    ServiceIdentity service = new ServiceIdentity();
    service.setName(ZMSUtils.serviceResourceName("providerdomain", "api"));
    zms.putServiceIdentity(mockDomRsrcCtx, "providerdomain", "api", auditRef, service);
    Tenancy tenant = new Tenancy().setDomain("sports").setService("providerdomain.api");
    zms.putTenant(mockDomRsrcCtx, "providerdomain", "api", "sports", auditRef, tenant);
    Role role = zms.getRole(mockDomRsrcCtx, "providerdomain", "api.tenant.sports.admin", false, false, false);
    assertNotNull(role);
    assertEquals(role.getTrust(), "sports");
    Policy policy = zms.getPolicy(mockDomRsrcCtx, "providerdomain", "api.tenant.sports.admin");
    assertNotNull(policy);
    assertEquals(policy.getAssertions().size(), 1);
    Assertion assertion = policy.getAssertions().get(0);
    assertEquals(assertion.getAction(), "*");
    assertEquals(assertion.getRole(), "providerdomain:role.api.tenant.sports.admin");
    assertEquals(assertion.getResource(), "providerdomain:service.api.tenant.sports.*");
    zms.deleteTopLevelDomain(mockDomRsrcCtx, "providerdomain", auditRef);
}