assertTrue("Identity was not removed", ps.removeIdentity(identity));
}
public void testUpdateIdentityWithRole() throws Exception
{
Identity identity = IdentityFactory.createIdentity(identityName);
assertFalse("File already exists", file.exists());
assertNotNull("Failed to persist", ps.persistIdentity(identity));
assertTrue("File was not created", file.exists());
Identity restored = ps.getIdentity(identityName);
assertEquals("Objects are different", identity, restored);
assertNull("Role must be null", restored.getRole());
identity = IdentityFactory.createIdentityWithRole(identityName, "testRole");
ps.updateIdentity(identity);
assertTrue("File was not re-created", file.exists());
restored = ps.getIdentity(identityName);
assertEquals("Objects are different", identity, restored);
assertEquals("Role names are different", identity.getRole().getRoleName(), restored.getRole().getRoleName());
}