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());
//    }
}
相关推荐
IT_Octopus16 分钟前
Spring Boot 中 ThreadLocal 请求上下文的完整生命周期
java·spring boot·spring
用户40966601317511 小时前
Lombok 你用对了吗?@Data 之外的 6 个隐藏神器
java·后端·代码规范
梅头脑1 小时前
交易跨10个库、日均千万订单——选错一次分布式事务方案,加班三个月重写
java·分布式
久久学姐1 小时前
基础转码学 AI:Java+Python 双语言入门,3 个月可落地实战项目
java·python·ai·转码·实战项目
花生了什么事o1 小时前
synchronized 与 ReentrantLock:Java 锁机制原理与实现对比
java·开发语言
长不胖的路人甲2 小时前
Serial 串行、Parallel 并行、CMS 并发收集器
java·开发语言·jvm
IT_Octopus3 小时前
Spring Boot 线程池关闭:destroyMethod 的作用与最佳实践
java·spring boot·后端
Python私教3 小时前
Codex 写出的代码能跑却算错钱:我用 3 个测试拆穿一次 AI 编程幻觉
python·单元测试·ai编程
亦暖筑序3 小时前
AgentScope-Java 入门:完善 Vue 前端、发布 GitHub,并规划下一步
java·前端·vue.js
wddptwd283 小时前
android studio 报错怎么处理 java.lang.NullPointerException
android·java·android studio