Testing

Testing Servlet Logic …

Suppose youare unit testing code and you need to test some logic in an HttpServlet. There are several approaches:

  • Use mockito to mock the HttpServletRequest and HttpServletResponse;

  • Refactor so the logi does not depend on the Servlet API at all (best approach)

  • Other?

I had a servlet …