-
Recent Posts
Archives
Categories
Link
Meta
Tag Archives: servlet
Mocking a multipart/form-data HTTP request in a unit test
If you have a servlet that processes HTML Form post data, you might want to simulate such a request in your unit tests. This is easily done with Apache Commons HttpClient using MultipartRequestEntity. This example uses MockHttpServletRequest from Spring, but can … Continue reading
Writing Unit Tests for Servlets
When writing unit tests for simple servlets you’ll need to write a lot boilerplate code for mocking out all these HttpServletRequest/Response/Context/… objects every time, plus it feels like too much of a white box test really. Surely there’s a better … Continue reading