intellij-idea - 创建新的 Kotlin 控制台并创建测试让 ID 为“junit-jupiter”的 TestEngine 无法发现测试
问题描述
创建新的 Kotlin 控制台应用程序
使用构建系统 IntelliJ Project SDK java1.8 和测试框架 JUnit5。目标 JVM 1.8
有什么想法可以解决吗?
并创建一个测试。
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
internal class SparseVectorTest {
@Test
fun dotProductCase1() {
val v1 = SparseVector(intArrayOf(1,0,1,2,9))
val v2 = SparseVector(intArrayOf(0,3,0,4,0))
assertEquals(8,v1.dotProduct(v2))
}
@Test
fun dotProductCase2() {
val v1 = SparseVector(intArrayOf(0,9,2,0,0))
val v2 = SparseVector(intArrayOf(0,0,0,1,2))
assertEquals(0,v1.dotProduct(v2))
}
@Test
fun getNums() {
val v1 = SparseVector(intArrayOf(0,1,0,0,0))
assertEquals(intArrayOf(0,1,0,0,0),v1.nums)
}
}
它编译通过但在运行时失败并出现错误
TestEngine with ID 'junit-jupiter' failed to discover tests
也尝试使用 jdk13.0.2 仍然得到相同的结果
解决方案
使用 Gradle Kotlin 作为构建系统并且运行良好
推荐阅读
- json - Laravel - 从 Foursquare API 获取和解析“复杂”JSON 响应
- reactjs - 反应本地化
- ios - xcode 管理器为 Mac OS Catalyst 归档文件提供不匹配权利的 iOS 配置文件
- html - 子 div 宽度不是 100%,左右两侧有某种填充
- security - 防止坚固的地毯
- f# - F#:为重载的构造函数提供类型注释
- sql-server - 有没有办法为 SSIS 包的变量添加锁?
- css - 如何根据 URL id 更改我的 CSS?
- python - 如何证明`fake.unique.ascii_free_email()`无论运行多少次都不会返回重复的电子邮件地址
- android - W/SyncTree:在 /users 处监听失败:DatabaseError:Permission denied 和 E/AndroidRuntime:FATAL EXCEPTION:main for unknow reason