6

It's not really coding question but I'm stuck on it. I start new Java project in Intelliji and add tests with JUnit5. In this tests I'm using @Role annotation for FakeSftpServerRule github library.

I added all jupiter dependencies I just can thought about them in the pom file:

<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-engine</artifactId>
    <version>1.6.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-launcher</artifactId>
    <version>1.6.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.5.2</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <version>5.6.0</version>
    <scope>test</scope>
</dependency>

It's the way to initialize the fake ftp:

@Rule
public final FakeSftpServerRule fakeSftpServer = new FakeSftpServerRule()
   .addUser(username, password)
   .setPort(port);

And I'm using regular other attributes, like @BeforeAll and @Test...

Running the tests throw this error:

Internal Error occurred. org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-vintage' failed to discover tests at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:189) at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:168) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69) at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230) at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58) Caused by: org.junit.platform.commons.JUnitException: Unsupported version of junit:junit: 4.11-beta-1. Please upgrade to version 4.12 or later. at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:39) at org.junit.vintage.engine.JUnit4VersionCheck.checkSupported(JUnit4VersionCheck.java:32) at org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:62) at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:181)

Now, by navigate to source I found that @BeforeAll and @Test annotations point on junit-jupiter 5.5.2 but @Role point on junit 4.11 (beta-1).

How can I get rid from junit 4.11 and update it to the latest version?

4

0 回答 0