@Test
public void testValidateGroupUserAuthorityAttrRequirements() {

    Group originalGroup = new Group().setName("group1").setUserAuthorityFilter("OnShore-US");
    Group updatedGroup = new Group().setName("group1");
    ObjectStoreConnection conn = Mockito.mock(ObjectStoreConnection.class);
    Mockito.when(conn.getPrincipalRoles("group1", null)).thenThrow(new ResourceException(ResourceException.BAD_REQUEST));
    try {
        zms.dbService.validateGroupUserAuthorityAttrRequirements(conn, originalGroup, updatedGroup, "unittest");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), ResourceException.BAD_REQUEST);
    }
    // now we're going to mock the use case where the role no longer exists
    List<MemberRole> memberRoles = new ArrayList<>();
    memberRoles.add(new MemberRole().setDomainName("coretech").setRoleName("role1"));
    DomainRoleMember domainRoleMember = new DomainRoleMember();
    domainRoleMember.setMemberRoles(memberRoles);
    ObjectStoreConnection conn2 = Mockito.mock(ObjectStoreConnection.class);
    Mockito.when(conn2.getPrincipalRoles("group1", null)).thenReturn(domainRoleMember);
    Mockito.when(conn2.getRole("coretech", "role1")).thenReturn(null);
    // the call will complete without any exceptions and no changes
    zms.dbService.validateGroupUserAuthorityAttrRequirements(conn2, originalGroup, updatedGroup, "unittest");
}