}
@Test
public void update() {
// get global password
PasswordPolicyTO globalPolicy = policyService.read(2L);
PasswordPolicyTO policy = new PasswordPolicyTO();
policy.setDescription("A simple password policy");
policy.setSpecification(globalPolicy.getSpecification());
// create a new password policy using global password as a template
policy = createPolicy(policy);
// read new password policy
policy = policyService.read(policy.getId());
assertNotNull("find to update did not work", policy);
PasswordPolicySpec policySpec = policy.getSpecification();
policySpec.setMaxLength(22);
policy.setSpecification(policySpec);
// update new password policy
policyService.update(policy.getId(), policy);
policy = policyService.read(policy.getId());
assertNotNull(policy);
assertEquals(PolicyType.PASSWORD, policy.getType());
assertEquals(22, policy.getSpecification().getMaxLength());
assertEquals(8, policy.getSpecification().getMinLength());
}