@Test
public void testPutRoleMeta() {

    final String domainName = "role-meta";
    final String roleName = "role1";
    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    RoleMeta meta = new RoleMeta().setSelfServe(true);
    Mockito.when(c.putRoleMeta(domainName, roleName, AUDIT_REF, meta))
            .thenThrow(new NullPointerException())
            .thenThrow(new ResourceException(403));
    try {
        client.putRoleMeta(domainName, roleName, AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    try {
        client.putRoleMeta(domainName, roleName, AUDIT_REF, meta);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 403);
    }
}