private void testPost(MediaType mediaType) throws IOException, ServletException, Exception {
MockHttpServletRequest request =
MockRequestConstructor.constructMockRequest("POST", "/test/person", mediaType.toString());
request.setContentType(mediaType.toString());
Person p = createPerson();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
WinkThriftProvider.marshal(p, mediaType, bos);
request.setContent(bos.toByteArray());
MockHttpServletResponse response = invoke(request);
assertEquals(200, response.getStatus());
byte[] data = response.getContentAsByteArray();
Person p1 = WinkThriftProvider.unmarshal(Person.class, mediaType, new ByteArrayInputStream(data));
assertEquals(p1);
}