Spring MVC Test with HtmlUnit
In my previous post I introduced Spring Test MVC HtmlUnit and explained the motivation behind the project. In this post I will describe how to use Spring MVC Test with HtmlUnit.
Updating Dependencies
Before you use the project, you must ensure to update your dependencies. Instructions for both Maven and Gradle can be found on the site documentation.
Using HtmlUnit
Now that we have the correct dependencies, we can use HtmlUnit in our unit tests. Our example assumes you already have JUnit as a dependency. If you have not added it, please update your classpath accordingly. The complete code sample for using HtmlUnit and Spring MVC Test can be found in MockMvcHtmlUnitCreateMessageTest…