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());
//    }
}
相关推荐
captain3761 小时前
多线程线程安全问题
java·java-ee
CoderYanger1 小时前
A.每日一题:1979. 找出数组的最大公约数
java·程序人生·算法·leetcode·面试·职场和发展·学习方法
灵极海1 小时前
LangChain4j RAG 实战完整指南:从入门到踩坑
java·langchain
yaoxin5211231 小时前
476. Java 反射 - 调用方法
java·开发语言
Ivanqhz2 小时前
Rust Lazy浅析
java·javascript·rust
bksczm2 小时前
Linux之日志和线程池、内存池
java·开发语言
笨蛋不要掉眼泪3 小时前
Java虚拟机:对象复活、引用强度与Stop-The-World
java·开发语言·jvm
凤山老林3 小时前
SpringBoot实战:构建优雅的全局异常处理机制
java·springboot·异常处理
小Ti客栈3 小时前
Spring Boot 整合 Swagger2 和 Knife4j实现接口文档与可视化调试
java·spring boot·后端
梅头脑3 小时前
ThreadLocalMap里几十万个死Entry——排查了半天OOM,根因就一行finally没写
java