@Test
public void testGetSignedDomains() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    Map<String, List<String>> respHdrs = new HashMap<>();
    SignedDomains signedDomain1 = Mockito.mock(SignedDomains.class);
    Mockito.when(c.getSignedDomains("dom1", "meta1", null, true, "tag1", respHdrs))
            .thenReturn(signedDomain1)
            .thenReturn(signedDomain1)
            .thenReturn(signedDomain1)
            .thenThrow(new ZMSClientException(401, "Audit reference required"))
            .thenThrow(new NullPointerException());
    client.getSignedDomains("dom1", "meta1", "tag1", respHdrs);
    client.getSignedDomains("dom1", "meta1", null, "tag1", respHdrs);
    client.getSignedDomains("dom1", "meta1", null, true, "tag1", respHdrs);
    try {
        client.getSignedDomains("dom1", "meta1", "tag1", respHdrs);
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(ex.getCode(), 401);
    }
    try {
        client.getSignedDomains("dom1", "meta1", null, true, "tag1", respHdrs);
        fail();
    } catch (ZMSClientException ex) {
        assertEquals(ex.getCode(), 400);
    }
}