If you have ever wondered how you could easily test your servlets with JUnit… Then I have found a very interesting blog entry for you
If you have used commons-httpclient, this is about as simple as it gets, but I still wanted to have a unit test for it. So the problem became, “how can I test this method when it requires that I hit a web site”. After some searching I found that the Jetty servlet-container has a ServletTester class just for this purpose.
I would like to recommend you to read the article to let you test more than you are now.