@Test
public void testAddDefaultAdminAssertion() {

    final String domainName = "put-default-assertion";
    final String policyName = "policy1";
    TopLevelDomain dom1 = createTopLevelDomainObject(domainName,
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    // add an empty policy to the domain
    Policy policy = createPolicyObject(domainName, policyName);
    zms.putPolicy(mockDomRsrcCtx, domainName, policyName, auditRef, policy);
    // add invalid assertions that will be skipped by the call
    // and we'll add the default assertion
    List<Assertion> assertList = new ArrayList<>();
    Assertion assertion = new Assertion();
    assertion.setResource(null);
    assertList.add(assertion);
    assertion = new Assertion();
    assertion.setResource(domainName + ":test");
    assertion.setAction(null);
    assertList.add(assertion);
    assertion = new Assertion();
    assertion.setResource(domainName + ":test");
    assertion.setAction("update");
    assertion.setRole(null);
    assertList.add(assertion);
    assertion = new Assertion();
    assertion.setResource(domainName + ":test");
    assertion.setAction("update");
    assertion.setRole("admin");
    assertList.add(assertion);
    assertion = new Assertion();
    assertion.setResource(domainName + ":test");
    assertion.setAction("update");
    assertion.setRole(ZMSUtils.roleResourceName(domainName, "admin"));
    assertion.setEffect(AssertionEffect.DENY);
    assertList.add(assertion);
    // add the assertion
    policy.setAssertions(assertList);
    zms.addDefaultAdminAssertion(mockDomRsrcCtx, domainName, policy, auditRef, "unit-test");
    // validate admin policy is correct set with assertion
    Policy policyRes = zms.getPolicy(mockDomRsrcCtx, domainName, "admin");
    boolean assert1Check = false;
    for (Assertion testAssert : policyRes.getAssertions()) {
        if ("*".equals(testAssert.getAction())) {
            assertEquals(testAssert.getResource(), domainName + ":*");
            assert1Check = true;
            break;
        }
    }
    assertTrue(assert1Check);
    zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}