Creating tests using Spring Boot 2.0
At this point, we are done with creating test classes using the Spring 5 framework from the ground up. This recipe will highlight how to build test classes using Spring Boot 2.0 spring-boot-starter-test
.
Getting ready
Open the Spring Boot ch09
project and implement some test cases using Spring Boot 2.0.
How to do it...
Let us implement test cases in Spring Boot 2.0 projects by performing the following steps:
- First, add the Spring Test starter POM in the
pom.xml
file:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
- This application is secured by Spring Security, so add the following Spring Security Test module to the application in order to utilize some mock-related annotations useful during testing:
<dependency> <groupId>org.springframework...