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:

  1. Setting up the Controller to test.
  2. Writing the test method.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset