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() {}
}
相关推荐
QC班长6 小时前
Maven公司私库配置踩坑点
java·服务器·maven·intellij-idea
Devin~Y7 小时前
大厂Java面试实录:Spring Boot/Cloud、Kafka、Redis、K8s 与 Spring AI(RAG/Agent)三轮连环问
java·spring boot·redis·mysql·spring cloud·kafka·kubernetes
GetcharZp7 小时前
比 Zap 还要快?Go 社区高性能日志神器 Zerolog 落地实践指南
后端
anzhxu8 小时前
Go基础之环境搭建
开发语言·后端·golang
刀法如飞8 小时前
一款Python语言Django框架DDD脚手架,适合中大型项目
后端·python·领域驱动设计
zb200641208 小时前
SpringBoot详解
java·spring boot·后端
AI人工智能+电脑小能手9 小时前
【大白话说Java面试题】【Java基础篇】第7题:HashMap的get流程是什么
java·后端·面试·哈希算法·散列表·hash-index·hash
mfxcyh10 小时前
使用MobaXterm配置nginx
java·服务器·nginx
霸道流氓气质10 小时前
SpringBoot+LangChain4j+Ollama+RAG(检索增强生成)实现私有文档向量化检索回答
java·spring boot·后端
MiNG MENS10 小时前
基于SpringBoot和Leaflet的行政区划地图掩膜效果实战
java·spring boot·后端