use of org.apache.sling.commons.json.JSONTokener in project sling by apache.
the class MockNodeTypeGenerator method assertEqualsWithServletResult.
public void assertEqualsWithServletResult(String filename) throws JSONException, ServletException, IOException {
NodeTypesJSONServlet generationServlet = new NodeTypesJSONServlet();
generationServlet.service(request, response);
verify(response, never()).sendError(anyInt());
String resultingJSON = new String(outStream.toByteArray(), "utf-8");
String expectedNTJSON = getExpectedNTJSON(filename);
JSONObject actualJsonObjectFromServlet = new JSONObject(new JSONTokener(resultingJSON));
JSONAssert.assertEquals("Actual JSON: " + resultingJSON + "\nExpected JSON: " + expectedNTJSON, new JSONObject(new JSONTokener(expectedNTJSON)), actualJsonObjectFromServlet);
}
Aggregations