@Test
public void testValidatePolicyAssertionsInValid() {

    
    // assertion missing domain name
    
    Assertion assertion = new Assertion();
    assertion.setAction("update");
    assertion.setEffect(AssertionEffect.ALLOW);
    assertion.setResource("resource1");
    assertion.setRole(ZMSUtils.roleResourceName("domain1", "role1"));
    List<Assertion> assertList = new ArrayList<>();
    assertList.add(assertion);
    
    try {
        zms.validatePolicyAssertions(assertList, "unitTest");
        fail();
    } catch (ResourceException ex) {
        assertEquals(400, ex.getCode());
    }
    
    // assertion with empty domain name
    
    assertion = new Assertion();
    assertion.setAction("update");
    assertion.setEffect(AssertionEffect.ALLOW);
    assertion.setResource(":resource1");
    assertion.setRole(ZMSUtils.roleResourceName("domain1", "role1"));
    
    assertList.clear();
    assertList.add(assertion);
    
    try {
        zms.validatePolicyAssertions(assertList, "unitTest");
        fail();
    } catch (ResourceException ex) {
        assertEquals(400, ex.getCode());
    }
    
    // assertion with invalid domain name
    
    assertion = new Assertion();
    assertion.setAction("update");
    assertion.setEffect(AssertionEffect.ALLOW);
    assertion.setResource("domain name:resource1");
    assertion.setRole(ZMSUtils.roleResourceName("domain1", "role1"));
    
    assertList.clear();
    assertList.add(assertion);
    
    try {
        zms.validatePolicyAssertions(assertList, "unitTest");
        fail();
    } catch (ResourceException ex) {
        assertEquals(400, ex.getCode());
    }
}