Spring Boot干货系列:(十二)Spring Boot使用单元测试
前言
这次来介绍下Spring Boot中对单元测试的整合使用,本篇会通过以下4点来介绍,基本满足日常需求
Service层单元测试
Controller层单元测试
新断言assertThat使用
单元测试的回滚正文
Spring Boot中引入单元测试很简单,依赖如下:<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
