@Test
public void testCreate_Var() throws Exception {
String url = "create.json?url=" +
URLEncoder.encode("http://localhost:8080/print-servlet/print/dep/create.json", Constants.DEFAULT_ENCODING);
ClientHttpRequest request = getPrintRequest(url, HttpMethod.POST);
setPrintSpec(getPrintSpec("examples/verboseExample/old-api-requestData.json"), request);
response = request.execute();
assertEquals(HttpStatus.OK, response.getStatusCode());
assertEquals(getJsonMediaType(), response.getHeaders().getContentType());
final JSONObject result = new JSONObject(getBodyAsText(response));
response.close();
String getUrl = result.getString("getURL");
final String prefix = "http://localhost:8080/print-servlet/print/dep/";
assertTrue(String.format("Start of url is not as expected: \n'%s'\n'%s'", prefix, getUrl), getUrl.startsWith(prefix));
assertTrue("Report url should end with .printout: " + getUrl, getUrl.endsWith(".printout"));
ClientHttpRequest requestGetPdf = httpRequestFactory.createRequest(new URI(getUrl), HttpMethod.GET);
response = requestGetPdf.execute();
assertEquals(response.getStatusText(), HttpStatus.OK, response.getStatusCode());
assertEquals(new MediaType("application", "pdf"), response.getHeaders().getContentType());
assertTrue(response.getBody().read() >= 0);
}