小编aya*_*aya的帖子

使用JUnit5时,出现警告:“ ClassNotFoundException:org.junit.platform.engine.support.filter.ExclusionReasonConsumingFilter”

我正在尝试使用JUnit5。
首先,我向maven项目添加了依赖项:

<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.3.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-runner</artifactId>
        <version>1.3.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

然后,我创建了一个测试:

package com.example.multicurrency;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

class JunitTests {
    @Test
    void testAssertTrue() {
        assertTrue(false);
    }
}
Run Code Online (Sandbox Code Playgroud)

之后,我运行测试。以下是我所得到的:

org.junit.platform.launcher.core.DefaultLauncher handleThrowable
warning: TestEngine with ID 'junit-vintage' failed to discover tests
java.lang.NoClassDefFoundError: org/junit/platform/engine/support/filter/ExclusionReasonConsumingFilter
Caused by: java.lang.ClassNotFoundException: org.junit.platform.engine.support.filter.ExclusionReasonConsumingFilter

org.opentest4j.AssertionFailedError: 
Expected :<true> 
Actual   :<false>
Run Code Online (Sandbox Code Playgroud)

结果是我所期望的。但是警告使我困惑。警告是什么意思?

java junit junit5

4
推荐指数
1
解决办法
8102
查看次数

标签 统计

java ×1

junit ×1

junit5 ×1