I am using Spring MVC to build a site and am trying to create a unit test for a controller method that serves an ajax call. The method writes some JSON to the response's output stream and returns null. I am passing in a org.springframework.mock.web.MockHttpServletResponse from the unit test, but I can't figure out how to examine the buffer. Is there a way to do this?
Well, I was wondering if there was something built into the mock response. The documentation is very poor. I may have to refactor my code so that the tests can intercept and check what is supposed to be being written to the response output stream.