assertNull(role.getPasswordPolicy());
}
@Test
public void save() {
SyncopeRole role = new SyncopeRole();
role.setName("secondChild");
// verify inheritance password and account policies
role.setInheritAccountPolicy(false);
// not inherited so setter execution shouldn't be ignored
role.setAccountPolicy((AccountPolicy) policyDAO.find(6L));
role.setInheritPasswordPolicy(true);
// inherited so setter execution should be ignored
role.setPasswordPolicy((PasswordPolicy) policyDAO.find(4L));
SyncopeRole rootRole = roleDAO.find("root", null);
role.setParent(rootRole);
role = roleDAO.save(role);
SyncopeRole actual = roleDAO.find(role.getId());
assertNotNull("expected save to work", actual);
assertNull(role.getPasswordPolicy());
assertNotNull(role.getAccountPolicy());
assertEquals(Long.valueOf(6), role.getAccountPolicy().getId());