@Test
public void testGetDomainSignedPolicyData() {

    ZTSRDLClientMock ztsClientMock = new ZTSRDLClientMock();
    ztsClientMock.setPolicyName("policy1");
    Principal principal = SimplePrincipal.create("user_domain", "user",
            "v=S1;d=user_domain;n=user;s=sig", PRINCIPAL_AUTHORITY);
    ZTSClient client = new ZTSClient("http://localhost:4080", principal);
    client.setZTSRDLGeneratedClient(ztsClientMock);
    Map<String, List<String>> responseHeaders = new HashMap<>();
    DomainSignedPolicyData domainSignedPolicyData =
            client.getDomainSignedPolicyData("coretech", null, responseHeaders);
    assertNotNull(domainSignedPolicyData);
    SignedPolicyData signedPolicyData = domainSignedPolicyData.getSignedPolicyData();
    assertNotNull(signedPolicyData);
    assertEquals(signedPolicyData.getZmsSignature(), "zmsSignature");
    assertEquals(signedPolicyData.getZmsKeyId(), "0");
    try {
        client.getDomainSignedPolicyData(null, null, responseHeaders);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    PolicyData policyData = signedPolicyData.getPolicyData();
    assertNotNull(policyData);
    assertEquals(policyData.getDomain(), "coretech");
    List<Policy> policyList = policyData.getPolicies();
    assertNotNull(policyList);
    assertEquals(policyList.size(), 1);
    assertEquals(policyList.get(0).getName(), "policy1");
    client.close();
}