测试
- 引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
-
在 test 目录下创建测试类
-
为测试类增加 @RunWith(SpringRunner.class) 和 @SpringBootTest 注解
-
使用 @Autowired 注入待测试类的对象
-
编写测试方法,增加 @Test 注解
package com.zhiyou100.dao;
import com.zhiyou100.entity.Use