@Test
public void testGetServiceIdentities() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    try {
        Mockito.when(c.getServiceIdentities("domain1", true, true)).thenThrow(new ResourceException(403));
        client.getServiceIdentities("domain1", true, true);
        fail();
    } catch  (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
    }
    try {
        Mockito.when(c.getServiceIdentities("domain2", true, true)).thenThrow(new NullPointerException());
        client.getServiceIdentities("domain2", true, true);
        fail();
    } catch  (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}