junit - 在 Kotlin 和 JUnit 5 中重复 @ExtendWith

标签 junit kotlin junit5

我在 Kotlin 项目中使用 JUnit 5 并观察到与文档不匹配的行为。
在测试类上使用多个 @ExtendWith 注释时,我收到以下错误:
Repeatable annotations with non-SOURCE retention are not yet supported enter image description here

Extension section of the JUnit documentation 中,这被列为有效选项。
我正在使用 Kotlin 1.3.10 和 JUnit 5.3.2

为什么我无法在我的测试类上重复 @ExtendWith 注释?

最佳答案

可重复的注释是 not yet supported in Kotlin 。但是,您可以使用 Extensions 注释:

@Extensions(
    ExtendWith(...),
    ExtendWith(...)
)

关于junit - 在 Kotlin 和 JUnit 5 中重复 @ExtendWith,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53544917/

相关文章:

java - 由于自定义约束 validator , validator 单元测试失败

java - 如何重复参数化的 Junit 5 测试?

java - 使用 JUnit 时出现断言错误

java - 数据从内存数据库中自动删除

安卓单元测试 : clearing prefs before testing activity

kotlin - 如何在kotlin中编写包含mutex.withLock的getter和setter

android - java.lang.ClassNotFoundException : Didn't find class "kotlinx.coroutines.experimental.Deferred"

java - Spring MVC 服务 Junit 测试用例

Android LinearLayout 和 RecyclerView BottomNavigation 对齐

android - 如何在 JUnit 5 扩展中存储值并在参数化测试中注入(inject)