@Test
public void testDeleteTenant() {

    TopLevelDomain dom1 = createTopLevelDomainObject("providerdomaindelete",
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    ServiceIdentity service = new ServiceIdentity();
    service.setName(ZMSUtils.serviceResourceName("providerdomaindelete", "api"));
    zms.putServiceIdentity(mockDomRsrcCtx, "providerdomaindelete", "api", auditRef, service);
    Tenancy tenant = new Tenancy().setDomain("sports").setService("providerdomaindelete.api");
    zms.putTenant(mockDomRsrcCtx, "providerdomaindelete", "api", "sports", auditRef, tenant);
    Role role = zms.getRole(mockDomRsrcCtx, "providerdomaindelete", "api.tenant.sports.admin", false, false, false);
    assertNotNull(role);
    Policy policy = zms.getPolicy(mockDomRsrcCtx, "providerdomaindelete", "api.tenant.sports.admin");
    assertNotNull(policy);
    zms.deleteTenant(mockDomRsrcCtx, "providerdomaindelete", "api", "sports", auditRef);
    try {
        zms.getRole(mockDomRsrcCtx, "providerdomaindelete", "api.tenant.sports.admin", false, false, false);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 404);
    }
    try {
        zms.getPolicy(mockDomRsrcCtx, "providerdomaindelete", "api.tenant.sports.admin");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 404);
    }
    zms.deleteTopLevelDomain(mockDomRsrcCtx, "providerdomaindelete", auditRef);
}