@Test
public void testProcessRoleUpdate() {

    ObjectStoreConnection conn = Mockito.mock(ObjectStoreConnection.class);
    Role originalRole = new Role().setName("originalRole").setAuditEnabled(false);
    Role role = new Role().setName("newRole").setAuditEnabled(true);
    StringBuilder auditDetails = new StringBuilder("testAudit");
    zms.dbService.processRole(conn, originalRole, "auditedDomain", "newRole",
            role, adminUser, auditRef, false, auditDetails);
    assertFalse(role.getAuditEnabled()); // original role does not have auditEnabled
    originalRole.setAuditEnabled(true);
    Role role2 = new Role().setName("newRole2").setAuditEnabled(false);
    zms.dbService.processRole(conn, originalRole, "auditedDomain", "newRole2",
            role2, adminUser, auditRef, false, auditDetails);
    assertTrue(role2.getAuditEnabled()); // original role has auditEnabled
    Role role3 = new Role().setName("newRole3").setAuditEnabled(false).setSelfServe(true);
    zms.dbService.processRole(conn, originalRole, "auditedDomain", "newRole3",
            role3, adminUser, auditRef, false, auditDetails);
    assertTrue(role3.getSelfServe());
    Role role4 = new Role().setName("newRole4").setAuditEnabled(false).setSelfServe(false);
    zms.dbService.processRole(conn, originalRole, "auditedDomain", "newRole4",
            role4, adminUser, auditRef, false, auditDetails);
    assertFalse(role4.getSelfServe());
}