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);
    }

}

相关推荐

  1. JUnit 5 单元测试框架

    2024-01-20 13:52:02       56 阅读
  2. 单元测试框架jUnit

    2024-01-20 13:52:02       62 阅读
  3. 单元测试框架 Junit

    2024-01-20 13:52:02       44 阅读
  4. JUnit5单元测试框架提供的注解

    2024-01-20 13:52:02       82 阅读
  5. JUNIT5+Mockito单元测试

    2024-01-20 13:52:02       39 阅读
  6. JUnit 5和Mockito单元测试

    2024-01-20 13:52:02       60 阅读
  7. 【Springboot】单元测试Junit5应用

    2024-01-20 13:52:02       50 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-20 13:52:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-20 13:52:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-20 13:52:02       82 阅读
  4. Python语言-面向对象

    2024-01-20 13:52:02       91 阅读

热门阅读

  1. C Primer Plus(第六版)12.9 编程练习 第2题

    2024-01-20 13:52:02       47 阅读
  2. C语言变量和全局变量能否重名?

    2024-01-20 13:52:02       54 阅读
  3. 代码随想录第22天| 二叉树

    2024-01-20 13:52:02       58 阅读
  4. 算法训练营Day36(贪心5)

    2024-01-20 13:52:02       60 阅读
  5. git format用法学习

    2024-01-20 13:52:02       52 阅读
  6. thinkphp6 模糊查找json下的字段值

    2024-01-20 13:52:02       49 阅读
  7. 【回溯】79. 单词搜索

    2024-01-20 13:52:02       49 阅读
  8. Flink中ProcessFunction的用法

    2024-01-20 13:52:02       55 阅读
  9. C++入门学习(四)常量

    2024-01-20 13:52:02       58 阅读