# @RunWith(JUnitPlatform.class) 在 Junit 5 的时候提示将会丢弃

**URL:** <https://www.isharkfly.com/t/runwith-junitplatform-class-junit-5/13818>\
**Category:** DevOps\
**Tags:** junit\
**Created:** [November 22, 2021, 6:53pm UTC](https://www.isharkfly.com/t/runwith-junitplatform-class-junit-5/13818 "2021-11-22T18:53:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [November 22, 2021, 6:53pm UTC](https://www.isharkfly.com/t/runwith-junitplatform-class-junit-5/13818/1 "2021-11-22T18:53:52Z")

</div>

在一个测试类的针对 Junit 5 的时候有下面的提示：

 ![image](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/2/d/2dfa3e832294c96ea40089d76bb1e3f27369d3be.jpeg)

## 问题和说明

使用 @RunWith(JUnitPlatform.class) 这个注解的目的是为了让这个测试能够在 IDE 和使用支持 JUnit 4 的构建系统，但是还不能直接支持 JUnit Platform 的情况下能够运行 Junit 测试。

如果你使用的是 JUnit 5 的话，你可以直接删除这句话就可以了。
