http://htmlunit.sourceforge.net/

HtmlUnit is a java unit testing framework for testing web based applications. It is similar in concept to httpunit  but is very different in implementation. Which one is better for you depends on how you like to write your tests. HttpUnit models the http protocol so you deal with request and response objects. HtmlUnit on the other hand, models the returned document so that you deal with pages and forms and tables.