@Test
public void testDeleteDomain() {

    // make sure we can't delete system domains
    try {
        zms.deleteDomain(mockDomRsrcCtx, auditRef, "sys.auth", "testDeleteDomain");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
        assertTrue(ex.getMessage().contains("reserved system domain"));
    }
    TopLevelDomain dom = createTopLevelDomainObject(
        "TestDeleteDomain", null, null, adminUser);
    dom.setAuditEnabled(true);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom);
    zms.deleteDomain(mockDomRsrcCtx, auditRef, "testdeletedomain", "testDeleteDomain");
    try {
        zms.getDomain(mockDomRsrcCtx, "TestDeleteDomain");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 404);
    }
}