@Test
public void testPutDomainSystemMeta() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    DomainMeta meta = new DomainMeta().setAccount("acct1");
    try {
        Mockito.when(c.putDomainSystemMeta("domain1", "account", AUDIT_REF, meta)).thenThrow(new NullPointerException());
        client.putDomainSystemMeta("domain1", "account", AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    try {
        Mockito.when(c.putDomainSystemMeta("domain2", "account", AUDIT_REF, meta)).thenThrow(new ResourceException(403));
        client.putDomainSystemMeta("domain2", "account", AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
    }
}