@Test
public void testValidateRole() {

    Role role = new Role();
    role.setName("athenz:role.role1");
    List<RoleMember> roleMembers = new ArrayList<>();
    roleMembers.add(new RoleMember().setMemberName("user.joe"));
    role.setRoleMembers(roleMembers);
    
    // first validation should be successful
    
    zms.validate(role, "Role", "testValidateRole");
    
    // now let's add invalid entry
    
    roleMembers.add(new RoleMember().setMemberName("user joe"));
    try {
        zms.validate(role, "Role", "testValidateRole");
        fail();
    } catch (ResourceException ignored) {
    }
    role = new Role().setName("coretech:role.dev-team");
    roleMembers = new ArrayList<>();
    roleMembers.add(new RoleMember().setMemberName("user.user1"));
    roleMembers.add(null);
    role.setRoleMembers(roleMembers);
    try {
        zms.validate(role, "Role", "testValidate");
        fail();
    } catch (ResourceException ex) {
        assertTrue(ex.getMessage().contains("Invalid Role"), ex.getMessage());
    }
}