@Test
public void testPostRoleCertificateRequest() {

    Principal principal = SimplePrincipal.create("user_domain", "user",
            "auth_creds", PRINCIPAL_AUTHORITY);
    ZTSClient client = new ZTSClient("http://localhost:4080", principal);
    ZTSRDLClientMock ztsClientMock = new ZTSRDLClientMock();
    client.setZTSRDLGeneratedClient(ztsClientMock);
    RoleCertificateRequest req = new RoleCertificateRequest().setCsr("csr");
    RoleToken roleToken = client.postRoleCertificateRequest("coretech", "role1", req);
    assertNotNull(roleToken);
    try {
        client.postRoleCertificateRequest("exc", "no-role", req);
        fail();
    } catch (ZTSClientException ex) {
        assertEquals(ex.getCode(), 400);
    }
    try {
        client.postRoleCertificateRequest("good-domain", "no-role", req);
        fail();
    } catch (ZTSClientException ex) {
        assertEquals(ex.getCode(), 403);
    }
    client.close();
}