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() {}
}
相关推荐
运维行者_8 小时前
企业无线网络监控的挑战与智能化演进趋势
大数据·运维·服务器·网络·数据库
码事漫谈9 小时前
别写Prompt了,现在流行给AI“写循环”
后端
Kyrie_Li9 小时前
Spring Boot Kafka 生产级配置全解析:从入门到精通
spring boot·后端·kafka
三8449 小时前
文件查找/文件压缩/解压缩
linux·运维·服务器
小猪写代码9 小时前
Linux 管道(Pipeline)作业
linux·运维·服务器
桌面运维家10 小时前
如何用半缓存云桌面将服务器硬盘容量扩展至本地终端?
运维·服务器·缓存
Jurio.10 小时前
Codex App SSH 远程开发教程:本地连接远程服务器项目
服务器·ssh·远程工作·codex
Coder_Shenshen10 小时前
西门子S7CommPlus协议鉴权算法原理与流程详解
网络·后端·算法
yuhaiqiang11 小时前
随手 vibecoding 的浏览器插件已经 6000 多次下载,聊聊他的产品设计
前端·后端·面试
geovindu12 小时前
python: Functional Options Pattern
开发语言·后端·python·设计模式·惯用法模式·函数式选项模式