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() {}
}
相关推荐
Jagger_1 小时前
AI 洪水淹到脖子了:剩下的是什么?我们该往哪儿跑?
后端
Victor3562 小时前
MongoDB(28)什么是地理空间索引?
后端
Victor3562 小时前
MongoDB(29)如何创建索引?
后端
皮皮林5513 小时前
面试官:什么是 fail-fast?什么是 fail-safe?
后端
陈随易4 小时前
前端大咖mizchi不满Rust、TypeScript却爱上MoonBit
前端·后端·程序员
雨中飘荡的记忆5 小时前
Multi-Agent + Skills + Spring AI 构建自主决策智能体
后端·spring
我叫黑大帅6 小时前
Go 语言并发编程的 “工具箱”
后端·面试·go
用户8356290780517 小时前
Python 实现 PowerPoint 形状动画设置
后端·python
用户908324602737 小时前
Spring Boot 缓存架构:一行配置切换 Caffeine 与 Redis,透明支持多租户隔离
后端