@Test
public void testUpdateUserAuthorityFilter() {

    Authority savedAuthority = zms.dbService.zmsConfig.getUserAuthority();
    Authority authority = Mockito.mock(Authority.class);
    Mockito.when(authority.isAttributeSet("user.john", "employee")).thenReturn(true);
    Mockito.when(authority.isAttributeSet("user.jane", "employee")).thenReturn(false);
    Mockito.when(authority.isAttributeSet("user.joe", "employee")).thenReturn(true);
    zms.dbService.zmsConfig.setUserAuthority(authority);
    RoleMember roleMemberJohn = new RoleMember().setMemberName("user.john").setSystemDisabled(null);
    assertFalse(zms.dbService.updateUserAuthorityFilter(roleMemberJohn, "employee"));
    roleMemberJohn.setSystemDisabled(0);
    assertFalse(zms.dbService.updateUserAuthorityFilter(roleMemberJohn, "employee"));
    roleMemberJohn.setSystemDisabled(1);
    assertTrue(zms.dbService.updateUserAuthorityFilter(roleMemberJohn, "employee"));
    assertEquals(roleMemberJohn.getSystemDisabled(), Integer.valueOf(0));
    RoleMember roleMemberJane = new RoleMember().setMemberName("user.jane").setSystemDisabled(null);
    assertTrue(zms.dbService.updateUserAuthorityFilter(roleMemberJane, "employee"));
    assertEquals(roleMemberJane.getSystemDisabled(), Integer.valueOf(1));
    assertFalse(zms.dbService.updateUserAuthorityFilter(roleMemberJane, "employee"));
    assertEquals(roleMemberJane.getSystemDisabled(), Integer.valueOf(1));
    // reset authority to its original value
    zms.dbService.zmsConfig.setUserAuthority(savedAuthority);
}