Equivalent for @RunWith(JUnitPlatform.class) for JUnit5

Szymon Żak :

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

Till this time, I was using

@RunWith(JUnitPlatform.class)

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

Dries Thieren :

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

In the junit documentation it states:

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.

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=310913&siteId=1