@Test
public void testExecutePutRoleReview() {

    final String domainName = "role-review";
    List<String> admins = new ArrayList<>();
    admins.add(adminUser);
    Timestamp thirtyDayExpiry = Timestamp.fromMillis(System.currentTimeMillis()
            + TimeUnit.MILLISECONDS.convert(30, TimeUnit.DAYS) + TimeUnit.MILLISECONDS.convert(1, TimeUnit.HOURS));
    zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject(domainName, "test desc", "org", false,
            "", 1234, "", 0), admins, null, auditRef);
    Role role1 = createRoleObject(domainName, "role1", null, "user.john", "user.jane");
    Timestamp timExpiry = Timestamp.fromMillis(System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(10, TimeUnit.DAYS));
    role1.getRoleMembers().add(new RoleMember().setMemberName("user.tim").setExpiration(timExpiry).setApproved(true).setActive(true));
    zms.dbService.executePutRole(mockDomRsrcCtx, domainName, "role1", role1, "test", "putrole");
    Role incomingRole = new Role().setName("role1");
    List<RoleMember> incomingMembers = new ArrayList<>();
    incomingMembers.add(new RoleMember().setMemberName("user.john").setActive(false).setExpiration(thirtyDayExpiry));
    incomingMembers.add(new RoleMember().setMemberName("user.jane").setActive(true).setExpiration(thirtyDayExpiry));
    incomingRole.setRoleMembers(incomingMembers);
    zms.dbService.executePutRoleReview(mockDomRsrcCtx, domainName, "role1", incomingRole, "review test", "putRoleReview");
    Role resRole = zms.dbService.getRole(domainName, "role1", false, false, false);
    assertEquals(resRole.getRoleMembers().size(), 2);
    int membersChecked = 0;
    for (RoleMember roleMember : resRole.getRoleMembers()) {
        switch (roleMember.getMemberName()) {
            case "user.jane":
                // user.jane is extended to new expiry
                assertEquals(roleMember.getExpiration(), thirtyDayExpiry);
                assertTrue(roleMember.getApproved());
                membersChecked += 1;
                break;
            case "user.tim":
                // user.tim was not part of incoming role, so he remains unchanged
                assertEquals(roleMember.getExpiration(), timExpiry);
                membersChecked += 1;
                break;
        }
    }
    assertEquals(membersChecked, 2);
    zms.dbService.executeDeleteDomain(mockDomRsrcCtx, domainName, auditRef, "deletedomain");
}