1.必备依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
2.快速生成测试类:ctr+shift+T
3. SpringBoot容器支持。
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
4.测试