【发布时间】:2020-03-11 12:26:00
【问题描述】:
在一个纯 Kotlin 项目中,我使用的是 JUnit Jupiter 5.5.2 和 AssertJ 3.10.0。以下测试执行成功:
@Test
fun `Validates something`() = runBlocking {
try {
// Assert something
} catch (t: Throwable) {
fail("Should not throw $t")
}
}
一旦我更新到AssertJ 3.11.1,测试构建就会失败并显示以下消息:
类型推断失败:没有足够的信息来推断有趣的参数 T 失败(p0:字符串!):T!
请明确指定。
如果我使用fail<Nothing>("Should not throw $t"),那么No test were found。
我试图弄清楚发生了什么 - 但没有成功。
相关
【问题讨论】:
-
不会使用
fail<Any>甚至fail<Any?>帮助吗?
标签: kotlin type-inference junit5 assertj