### Question:
JsonResponse extends HttpResponse { @Override public void execute(HttpServletResponse resp) throws IOException { resp.setContentType("application/json;charset=UTF-8"); resp.setCharacterEncoding("UTF-8"); if (json != null) { resp.getWriter().print(json); } } JsonResponse();  JsonResponse(String json); @Override String getText(); @Override void execute(HttpServletResponse resp);  }### Answer:
@Test public void testJsonResponseContentType() throws IOException { HttpServletResponse httpServletResponse = new MockHttpServletResponse(); String json = null; JsonResponse jsonResponse = new JsonResponse(json); jsonResponse.execute(httpServletResponse); assertEquals("application/json;charset=UTF-8", httpServletResponse.getContentType()); }
@Test public void testJsonResponseCharacterEncoding() throws IOException { HttpServletResponse httpServletResponse = new MockHttpServletResponse(); String json = null; JsonResponse jsonResponse = new JsonResponse(json); jsonResponse.execute(httpServletResponse); assertEquals("UTF-8", httpServletResponse.getCharacterEncoding()); }