@Test
public void testCheckRoleMemberValidity() {

    List<RoleMember> roleMembers = new ArrayList<>();
    // valid members
    RoleMember roleMemberJoe = new RoleMember()
            .setMemberName("user.joe")
            .setPrincipalType(Principal.Type.USER.getValue());
    RoleMember roleMemberJane = new RoleMember()
            .setMemberName("user.jane")
            .setSystemDisabled(null)
            .setExpiration(null);
    RoleMember roleMemberJohn = new RoleMember()
            .setSystemDisabled(0)
            .setMemberName("user.john")
            .setExpiration(Timestamp.fromMillis(System.currentTimeMillis() + 100000));
    roleMembers.add(roleMemberJoe);
    roleMembers.add(roleMemberJane);
    roleMembers.add(roleMemberJohn);
    // invalid members
    RoleMember roleMemberJoeBad = new RoleMember()
            .setMemberName("user.joe-bad")
            .setSystemDisabled(1);
    RoleMember roleMemberJaneBad = new RoleMember()
            .setMemberName("user.jane-bad")
            .setSystemDisabled(null)
            .setExpiration(Timestamp.fromMillis(System.currentTimeMillis() - 1));
    RoleMember roleMemberJohnBad = new RoleMember()
            .setSystemDisabled(3)
            .setMemberName("user.john-bad")
            .setExpiration(Timestamp.fromMillis(System.currentTimeMillis() - 10000));
    RoleMember roleGroup1  = new RoleMember()
            .setMemberName("coretech:group.dev-team")
            .setPrincipalType(Principal.Type.GROUP.getValue());
    roleMembers.add(roleMemberJoeBad);
    roleMembers.add(roleMemberJaneBad);
    roleMembers.add(roleMemberJohnBad);
    roleMembers.add(roleGroup1);
    // carry out the checks
    assertTrue(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.joe", nullFetcher));
    assertTrue(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.jane", nullFetcher));
    assertTrue(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.john", nullFetcher));
    assertFalse(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.joe-bad", nullFetcher));
    assertFalse(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.jane-bad", nullFetcher));
    assertFalse(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.john-bad", nullFetcher));
    assertFalse(AuthzHelper.checkRoleMemberValidity(roleMembers, "user.unknown", nullFetcher));
}