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() {}
}
相关推荐
bjxiaxueliang3 小时前
一文掌握SpringBoot:HTTP服务开发从入门到部署
spring boot·后端·http
小二李12 小时前
第11章 nestjs服务端开发:登录鉴权
运维·服务器
i建模12 小时前
如何在Arch Linux中重设忘记的root密码
linux·运维·服务器
过期动态15 小时前
Java开发中的@EnableWebMvc注解和WebMvcConfigurer接口
java·开发语言·spring boot·spring·tomcat·maven·idea
何中应15 小时前
vmware的linux虚拟机如何设置以命令行方式启动
linux·运维·服务器
野犬寒鸦15 小时前
从零起步学习并发编程 || 第一章:初步认识进程与线程
java·服务器·后端·学习
我爱娃哈哈16 小时前
SpringBoot + Flowable + 自定义节点:可视化工作流引擎,支持请假、报销、审批全场景
java·spring boot·后端
百炼成神 LV@菜哥16 小时前
Kylin Linux V10 aarch64 安装启动 TigerVNC-Server
linux·服务器·kylin
m0_7373025816 小时前
百度智能云边缘云服务器,端云协同赋能全域智能场景
服务器
Anastasiozzzz16 小时前
LeetCode Hot100 295. 数据流的中位数 MedianFinder
java·服务器·前端