ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 一.引入依赖 ~~~ <!-- SpringBoot集成junit测试的起步依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> </dependency> ~~~ ***** ### 二. 创建测试文件 ~~~ package com.youworker; //src/test/java/com/youworker/MybatisTest.java import com.youworker.domain.User; import com.youworker.mapper.UserMapper; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; import java.util.List; @RunWith(SpringRunner.class) @SpringBootTest public class MybatisTest { @Autowired UserMapper userMapper; @Test public void index(){ List<User> users = userMapper.queryUserList(); System.out.println(users.size()); System.out.println(users); } } ~~~