@Test
public void testGetGroups() {

    final String domainName = "get-groups";
    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    Mockito.when(c.getGroups(domainName, true))
            .thenThrow(new NullPointerException())
            .thenThrow(new ResourceException(401));
    try {
        client.getGroups(domainName, true);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    try {
        client.getGroups(domainName, true);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 401);
    }
}