java 单元测试 junit 4使用

需要的maven 包

xml 复制代码
		<!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

java 注解

java 复制代码
package com.basehuman.manager.service;

import com.basehuman.BaseHumanApplication;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;



@RunWith(SpringRunner.class)
@SpringBootTest(classes = BaseHumanApplication.class)
public class MiniTest {

//    @Autowired
//    private FollowRecordService followRecordService;
//
//    @Test
//    public void miniAccountFollowRecordList() {
//
//        MiniRecordVo vo = new MiniRecordVo();
//        vo.setAccountId(220L);
//        List<MiniFollowRecordPo> list = followRecordService.miniAccountFollowRecordList(vo);
//        System.out.println(list.size());
//    }
}
相关推荐
xjz184210 分钟前
JVM虚拟线程:JEP 444开启Java并发编程新纪元
java
JH307311 分钟前
Spring Retry 实战:优雅搞定重试需求
java·后端·spring
蓝眸少年CY25 分钟前
测试Java性能
java·开发语言·python
何包蛋H25 分钟前
数据结构深度解析:Java Map 家族完全指南
java·开发语言·数据结构
linsa_pursuer1 小时前
最长连续序列
java·数据结构·算法·leetcode
强子感冒了1 小时前
Java集合框架深度学习:从Iterable到ArrayList的完整继承体系
java·笔记·学习
drebander1 小时前
Cursor IDE 中 Java 项目无法跳转到方法定义问题解决方案
java·ide·cursor
来不及辣哎呀1 小时前
学习Java第六十二天——Hot 100-09-438. 找到字符串中所有字母异位词
java·开发语言·学习
linsa_pursuer1 小时前
移动零算法
java·算法
lihao lihao1 小时前
模板进阶
java·数据结构·算法