@Test
public void testDeleteDomainRoleMember() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    Mockito.when(c.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF))
            .thenReturn(null)
            .thenThrow(new ZMSClientException(401, "fail"))
            .thenThrow(new IllegalArgumentException("other-error"));
    // first time it completes successfully
    client.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF);
    // second time it fails with zms client exception
    try {
        client.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF);
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(401, ex.getCode());
    }
    // last time with std exception - resulting in 400
    try {
        client.deleteDomainRoleMember("athenz", "athenz.api", AUDIT_REF);
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(400, ex.getCode());
    }
}