@Test
public void testGetQuota() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    Quota quota = new Quota().setName("athenz").setAssertion(10).setEntity(11)
            .setPolicy(12).setPublicKey(13).setRole(14).setRoleMember(15)
            .setService(16).setServiceHost(17).setSubdomain(18);
    Mockito.when(c.getQuota("athenz")).thenReturn(quota)
            .thenThrow(new ZMSClientException(401, "fail"))
            .thenThrow(new IllegalArgumentException("other-error"));
    
    Quota quotaRes = client.getQuota("athenz");
    assertNotNull(quotaRes);
    assertEquals(quotaRes.getPolicy(), 12);
    assertEquals(quotaRes.getRole(), 14);
    // second time it fails
    try {
        client.getQuota("athenz");
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(401, ex.getCode());
    }
    // last time with std exception
    try {
        client.getQuota("athenz");
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(400, ex.getCode());
    }
}