title: Unit testing a Java Servlet
body: <p>I would like to know what would be the best way to do unit testing of a servlet. </p>
  
  <p>Testing internal methods is not a problem as long as they don't refer to the servlet context, but what about testing the doGet/doPost methods as well as the internal method that refer to the context or make use of session parameters?</p>
  
  <p>Is there a way to do this simply using classical tools such as JUnit, or preferrably TestNG? Did I need to embed a tomcat server or something like that?</p>