JUnit tests for the Spring Boot application
Spring Boot provides two modules for test support—sprint-boot-test
and spring-boot-test-autoconfigure
. spring-boot-test
contains core items, and spring-boot-test-autoconfigure
supports auto-configuration for tests. These modules have a number of utilities and annotations to help when testing your application. It is very simple to add these modules in the Spring Boot application by adding the spring-boot-starter-test
starter dependency in your Maven file. This starter imports both Spring Boot test modules as well as JUnit, AssertJ, Hamcrest, and a number of other useful libraries. Let's see the following Maven dependency to include test support in the Spring Boot application:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency>
The preceding Maven dependency will add the following libraries to your Spring...