本文介绍了等效于JUnit5的@RunWith(JUnitPlatform.class)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在做一些清理工作,并决定将所有内容移至JUnit5.

In my project I'm doing some cleanup and decided to move everything to JUnit5.

直到这次,我一直在使用

Till this time, I was using

@RunWith(JUnitPlatform.class)

现在,我想将其迁移到@ExtendWith. JUnit5中的此JUnitPlatform.class是否有任何等效项?

Now I want to migrate it to @ExtendWith. Is there any equivalent for this JUnitPlatform.class in JUnit5?

推荐答案

使用junit 5时不再需要它.

You don't need it anymore when using junit 5.

junit文档中它指出:

用@RunWith(JUnitPlatform.class)注释一个类,使它可以与IDE一起运行,并构建支持JUnit 4但尚不直接支持JUnit Platform的系统.

Annotating a class with @RunWith(JUnitPlatform.class) allows it to be run with IDEs and build systems that support JUnit 4 but do not yet support the JUnit Platform directly.

因此,既然您要迁移到junit 5,那么我想您的构建系统/IDE会支持它.因此,您不再需要注释.

So since you are migrating to junit 5 I suppose your build system/IDE supports it. Hence, you don't need the annotation anymore.

这篇关于等效于JUnit5的@RunWith(JUnitPlatform.class)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 20:48