上QQ阅读APP看书,第一时间看更新
Unit testing
Unit testing is a very important part of developing maintainable applications. We will be using the Spring MVC Mock framework to unit test the Controllers that we will write in this chapter. We will add in a dependency on the Spring test framework to use the Spring MVC Mock framework:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
The approach we will be taking would involve the following:
- Setting up the Controller to test.
- Writing the test method.