AssertJ: Type inference failed: Not enough information to infer parameter T in org.assertj.core.api.Assertions.fail
在一个纯Kotlin项目中,我正在使用JUnit Jupiter 5.5.2和AssertJ 3.10.0。以下测试成功执行:
1 2 3 4 5 6 7 8 | @Test fun `Validates something`() = runBlocking { try { // Assert something } catch (t: Throwable) { fail("Should not throw $t") } } |
一旦我更新到AssertJ 3.11.1,测试构建就会失败,并显示以下消息:
Type inference failed: Not enough information to infer parameter T in fun fail(p0: String!): T!
Please specify it explicitly.
如果我使用
我试图弄清楚发生了什么-尽管没有成功。
有关的
- JUnit5问题#1209:如果未明确指定通用类型,则无法在Kotlin中调用"失败"
似乎问题在于
1 2 3 4 5 6 7 8 9 10 | @Test fun `Validates something`() { runBlocking { try { // Assert something } catch (t: Throwable) { fail<Nothing>("Should not throw $t") } } } |