I'm unit testing my Java/Jersey web service and running into an interesting test case. I'm checking the status codes of different URI entries to make sure that incorrect URIs won't destroy my code or anything. In test cases where I throw in invalid characters (such as !@$#<>, etc.), my browser pulls up a 404 error like I would expect, but JUnit is showing the error as a 500 error. This happens in cases where I throw in things like "<134->" and cases where I try injecting html code (such as "myURI<html><p>hello</p><br></html>/restofmyURI
").
Any ideas why I would be getting different server responses for the same call, and/or how to consolidate the responses?