@Test
public void testPutGroupSystemMeta() {

    final String domainName = "group-sys-meta";
    final String groupName = "group1";
    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    GroupSystemMeta meta = new GroupSystemMeta().setAuditEnabled(true);
    Mockito.when(c.putGroupSystemMeta(domainName, groupName, "auditenabled", AUDIT_REF, meta))
            .thenThrow(new NullPointerException())
            .thenThrow(new ResourceException(403));
    try {
        client.putGroupSystemMeta(domainName, groupName, "auditenabled", AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    try {
        client.putGroupSystemMeta(domainName, groupName, "auditenabled", AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
    }
}