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() {}
}
相关推荐
还是鼠鼠16 分钟前
Node.js 跨域 CORS 简单请求与预检请求的介绍
运维·服务器·vscode·中间件·node.js·express
我命由我123451 小时前
35.Java线程池(线程池概述、线程池的架构、线程池的种类与创建、线程池的底层原理、线程池的工作流程、线程池的拒绝策略、自定义线程池)
java·服务器·开发语言·jvm·后端·架构·java-ee
whoarethenext4 小时前
qt的基本使用
开发语言·c++·后端·qt
影龙帝皖7 小时前
Linux网络之局域网yum仓库与apt的实现
linux·服务器·网络
草捏子8 小时前
主从延迟导致数据读不到?手把手教你架构级解决方案
后端
打工人你好8 小时前
UNIX域套接字(Unix Domain Sockets, UDS) 的两种接口
服务器·unix
橘猫云计算机设计8 小时前
基于Python电影数据的实时分析可视化系统(源码+lw+部署文档+讲解),源码可白嫖!
数据库·后端·python·信息可视化·小程序·毕业设计
lorogy9 小时前
【VSCode配置】运行springboot项目和vue项目
vue.js·spring boot·vscode
Yolo@~9 小时前
SpringBoot无法访问静态资源文件CSS、Js问题
java·spring boot·后端
AI云师兄9 小时前
MCP 实战系列(Day 2)- 动手搓个文件系统 MCP 服务器
服务器·人工智能·ai编程