MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/foo");
String requestBody = "Hello World";
request.setContent(requestBody.getBytes("UTF-8"));
request.addHeader("Content-Type", "text/plain; charset=utf-8");
request.addHeader("Accept", "text/*, */*");
request.addHeader("MyRequestHeader", "MyValue");
MockHttpServletResponse response = new MockHttpServletResponse();
servlet.service(request, response);
assertEquals(201, response.getStatus());
assertEquals(requestBody, response.getContentAsString());
assertEquals("MyValue", response.getHeader("MyResponseHeader"));