### Question:
HttpUtils { public static String readStringFromRequest(WebRequest request) throws IOException { HttpServletRequest httpRequest = (HttpServletRequest)request.getContainerRequest(); return IOUtils.toString(httpRequest.getReader()); }  static String readStringFromRequest(WebRequest request); static HttpMethod getHttpMethod(Request request); static HttpMethod getHttpMethod(WebRequest request);  }### Answer:
@Test public void readRequestString() throws Exception { String xmlText = "<?xml version='1.0' encoding='UTF-8'?>\n" + "<html>\n" + " <body>\n" + " <p >\n" + " </p>\n" + " </body>\n" + "</html>"; MockApplication mockApplication = new MockApplication(); MockServletContext servletContext = new MockServletContext(mockApplication, "/"); BufferedMockRequest mockedRequest = new BufferedMockRequest(mockApplication, new MockHttpSession(servletContext), servletContext, "POST"); mockedRequest.setTextAsRequestBody(xmlText); WebRequest webRequest = mock(WebRequest.class); when(webRequest.getContainerRequest()).thenReturn(mockedRequest); String stringFromRequest = HttpUtils.readStringFromRequest(webRequest); assertEquals(xmlText, stringFromRequest); }