spring boot 测试用例

依赖包

复制代码
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.2.5.RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-test</artifactId>
            <version>2.2.6.RELEASE</version>
            <scope>compile</scope>
        </dependency>

目录结构

复制代码
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.*;

@RunWith(SpringRunner.class)
@SpringBootTest
public class Test {

    @org.junit.Test
    public void test() {}
}
相关推荐
她的男孩9 小时前
会签选了两个人,待办却生成一条谁也办不了:Forge Admin 按人拆开自选审批人
spring boot·低代码·工作流引擎
AAA修煤气灶刘哥9 小时前
两个 Agent 各自改得都对,合在一起为什么出错?
人工智能·后端·算法
Cosolar9 小时前
概率性计算的系统工程:从 Super-agent 与 Octop 看多 Agent 架构的收敛
人工智能·后端·架构
bai2739 小时前
npm 在 cmd 里能跑,Node 的 spawn 一调就 EINVAL:Windows 上 .cmd 的六种调法实测
javascript·后端
无奈笑天下9 小时前
Wine适配Windows程序常见故障标准处理流程
linux·运维·服务器·windows
挖掘狂人9 小时前
如何保证缓存与数据库一致性
数据库·后端·程序员
SimonKing9 小时前
别再自己写同步脚本了!这款开源中间件,一套界面搞定 22 种数据源
java·后端·程序员
沫璃染墨9 小时前
从零入门计算机网络系列(二十六):IPv4分片机制详解——从MTU与MSS到报文分片与重组
运维·服务器·网络·网络协议·tcp/ip·ip
头发还在的女程序员10 小时前
Spring Boot云快充协议接入:Netty报文分帧、长度检查与校验处理设计
java·spring boot·后端·充电桩·充电桩小程序·云快充
无足鸟ICT10 小时前
【RHCA+】hdparm命令(查看硬盘)
linux·运维·服务器