当前位置: 首页 > news >正文

JUnit 5 单元测试框架

依赖安装

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

所有支持的注解都在包 org.junit.jupiter.api 下。

基本使用:

import org.junit.Assert;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;

@SpringBootTest
public class SampleTest {

    @Resource
    private UserMapper userMapper;

    @Test
    public void testSelect() {
        System.out.println(("----- selectAll method test ------"));
        List<User> userList = userMapper.selectList(null);
        Assert.assertEquals(5, userList.size());
        userList.forEach(System.out::println);
    }

}
http://www.dtcms.com/a/7518.html

相关文章:

  • 服务器运维小技巧(一)——如何进行远程协助
  • openssl3.2 - 官方demo学习 - smime - smsign2.c
  • 安全帽/反光衣检测AI边缘计算智能分析网关V4如何修改IP地址?
  • Docker(一)简介和基本概念
  • 【性能调优】local模式下flink处理离线任务能力分析
  • 【Leetcode】277.搜寻名人
  • 【数据结构】二叉树(遍历,递归)
  • 【LeetCode】206. 反转链表
  • Python GUI库大汇总
  • Keil 的安装
  • Spring IOC原理
  • 【协议】XMLHttpRequest的梳理和总结
  • 高并发大游戏如何选择阿里云服务器配置?
  • MySQL窗口函数(MySQL Window Functions)
  • 安全审查常见要求
  • 橘子学Mybatis07之Mybatis关于缓存的设计
  • 【计算机硬件】2、指令系统、存储系统和缓存
  • 力扣(144. 二叉树的前序遍历94.二叉树的中序遍历145. 二叉树的后序遍历)
  • 阿里云国外服务器价格表
  • OSI七层协议和五层协议
  • 美颜技术对比:如何根据项目选择不同的美颜SDK?
  • Win10恢复环境是什么?
  • Blender——将模型及其所有纹理与材质导入unity
  • [Python练习]使用Python爬虫爬取豆瓣top250的电影的页面源码
  • 怎么修改或移除WordPress后台仪表盘概览底部的版权信息和主题信息?
  • What is `HttpServletRequestWrapper` does?
  • Mac ❀ 如何在MacOS上安装pip软件包
  • 为什么要用B+树
  • 初识MySQL
  • chrome 307状态码