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());
//    }
}
相关推荐
短剑重铸之日1 分钟前
SpringBoot声明式事务的源码解析
java·后端·spring·springboot
李白的粉3 分钟前
基于springboot的银行客户管理系统(全套)
java·spring boot·毕业设计·课程设计·源代码·银行客户管理系统
JIngJaneIL6 分钟前
基于springboot + vue房屋租赁管理系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot·后端
努力的小南22 分钟前
Java字节码文件常量池索引两个问题
java·常量池·字节码文件·黑马jvm字节码文件常量池索引
期待のcode27 分钟前
Java的抽象类和接口
java·开发语言
while(1){yan}29 分钟前
SpringDI
java·jvm·spring·java-ee
陈平安安32 分钟前
设计一个秒杀功能
java·数据库·sql
TAEHENGV43 分钟前
基本设置模块 Cordova 与 OpenHarmony 混合开发实战
android·java·数据库
千寻技术帮1 小时前
10422_基于Springboot的教务管理系统
java·spring boot·后端·vue·教务管理
milanleon1 小时前
使用Spring Security进行登录认证
java·前端·spring