TestEngine with ID 'junit-vintage' failed to discover tests java.lang.NoClassDefFoundError:

博客内容讲述了作者在进行Java测试时遇到的TestEngine报错,具体表现为`java.lang.NoClassDefFoundError`。在解决过程中,作者尝试了添加注解和调整依赖,并注意到`keyProperty`中的命名问题,应当对应entity而非数据库字段。此外,还遇到了数据库图形化工具sqlyog未显示新数据的问题,经过多次刷新、重启和查阅StackOverflow后,找到了问题所在并进行了修复。最终,作者更新了pom文件中的测试依赖,解决了报错并确保测试能正常运行。
摘要由CSDN通过智能技术生成

最开始报错

Failed to resolve org.junit.platform:junit-platform-launcher:1.5.2

添加注解

@SpringBootTest
@RunWith(SpringRunner.class)

其中第二个注解需要依赖

import org.junit.runner.RunWith;

重新添加大部分依赖

<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-launcher</artifactId>
    <version>1.0.0-RC2</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.0.0-RC2</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.vintage</groupId>
    <artifactId>junit-vintage-engine</artifactId>
    <version>4.12.0-RC2</version>
    <scope>test</scope>
<
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值