【发布时间】:2023-03-14 22:43:01
【问题描述】:
我正在尝试在我的 Kotlin 应用程序中使用 JUnit4 实现测试(因为 kotlin.test 在我的 Kotlin 运行时库中似乎不存在,我现在不知道如何获取它)。
但是,我只是通过使用 Test 注释遇到了错误。
这是我的代码:
import junit.framework.*
class IntTest {
@Test <------------- This line
fun test1() {
}
}
在指定的行,Eclipse 给出错误消息:"This class does not have a constructor"。
我不明白有什么问题。哪个类没有构造函数,为什么要有构造函数?
【问题讨论】:
-
尝试添加
import org.junit.Test;