@Test
public void testGetGroupMembership() {

    final String domainName = "get-group-mbr";
    final String groupName = "group1";
    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    GroupMembership member1Mock = Mockito.mock(GroupMembership.class);
    Mockito.when(c.getGroupMembership(domainName, groupName, "user.joe", null))
            .thenReturn(member1Mock)
            .thenThrow(new ResourceException(403))
            .thenThrow(new NullPointerException());
    client.getGroupMembership(domainName, groupName, "user.joe", null);
    try {
        client.getGroupMembership(domainName, groupName, "user.joe", null);
        fail();
    } catch  (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
    }
    try {
        client.getGroupMembership(domainName, groupName, "user.joe", null);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}