assertTrue(result.startsWith("data({"));
}
@Test
public void testCallbackPost() throws URISyntaxException, IOException {
HttpExchange exchange = prepareExchange("http://localhost:8080/jolokia?callback=data");
// Simple GET method
expect(exchange.getRequestMethod()).andReturn("POST");
Headers reqHeaders = new Headers();
reqHeaders.add("Content-Type","text/plain; charset=UTF-8");
expect(exchange.getRequestHeaders()).andReturn(reqHeaders);
String req = "{\"timestamp\":1287914327,\"status\":200," +
"\"request\":{\"mbean\":\"java.lang:type=Memory\",\"attribute\":\"HeapMemoryUsage\",\"type\":\"read\"}," +
"\"value\":{\"max\":\"129957888\",\"committed\":\"85000192\",\"init\":\"0\",\"used\":\"6813824\"}}";
byte[] buf = req.getBytes("utf-8");
InputStream is = new ByteArrayInputStream(buf);
expect(exchange.getRequestBody()).andReturn(is);
Headers header = new Headers();
ByteArrayOutputStream out = prepareResponse(handler, exchange, header);
handler.handle(exchange);