@Test
public void testPutServiceIdentity() {

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