title: How can I unit-test a Jersey web application deployed on Tomcat?
body: <p>I'm building a Jersey web application deployed on Tomcat. I'm having a hard time understanding how to unit test the app. </p>
  
  <p>Testing the core business logic (the non-Jersey-resource classes) is possible by simply instantiating the classes in my tests and calling methods on them (this has nothing to do with Jersey or Tomcat).</p>
  
  <p>But what is the right way to unit test the Jersey resource classes (i.e., the classes that map to URLs)?</p>
  
  <p>Do I need to have Tomcat running for this? Or should I mock the request and response objects, instantiate the resource classes in my tests, and feed the mocks to my classes?</p>
  
  <p>I have read about testing in Jersey's site, but they're using Grizzly and not Tomcat in their examples, which is different.</p>
  
  <p>Please explain how this should be done. Example code would be welcome.</p>