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());
//    }
}
相关推荐
EatFan8 小时前
Spring Boot 4.0 升级清单:JDK 基线、Jakarta 命名空间、Observation API 与第三方组件兼容一次讲清
java·spring boot·后端
辰海Coding8 小时前
平台如何接入一台物联网设备?又该如何设计它的通信协议?
java·物联网
代码民工正电荷8 小时前
JAVA重要知识点和集合
java·开发语言
李少兄10 小时前
IDEA Apifox Helper 插件踩坑:2.0.15-243 版本“导出指定接口”参数描述丢失问题解析与修复方案
java·ide·intellij-idea
努力攀登的小k10 小时前
《新手练表:从建表到删表全操作|从零学会表操作》
java·数据库·mysql
Yetian_200011 小时前
Postman测试上传图片文件接口
java·postman
爪哇碎碎念11 小时前
【Java】从一次 cache.get(key) 进去:缓存击穿一瞬间打出 200 次 DB,JDK 17 实测三种解法
java·redis·缓存
csdn_aspnet11 小时前
Java 使总距离最短的最佳点位置(Optimum location of point to minimize total distance)
java·算法
源码_空间11 小时前
基于Springboot的在线编程练习判题平台(源码+文档)
java·spring boot·后端
小手cool13 小时前
二分查找:在有序数组中查找最接近 target 的元素索引
java·数据结构·算法