Я использую следующую версию junit 5
<junit.jupiter.version>5.2.0</junit.jupiter.version>
<junit.platform.version>1.2.0</junit.platform.version>
<junit.vintage.version>5.2.0</junit.vintage.version>
Версия Kotlin
<kotlin.version>1.2.31</kotlin.version>
Я пытаюсь использовать новую функциональность утверждений из junit 5 с kotlin, например
assertAll("person",
{ assertEquals("John", person.firstName) },
{ assertEquals("Doe", person.lastName) }
)
, но анализатор кода говорит, что подходящей версии метода не найдено.
Error:(28, 9) Kotlin: None of the following functions can be called with the arguments supplied:
public fun assertAll(vararg executables: () -> Unit): Unit defined in org.junit.jupiter.api
public fun assertAll(heading: String?, vararg executables: () -> Unit): Unit defined in org.junit.jupiter.api
Если я напишу код, подобный этому, он будет работать нормально.В чем прикол?
assertAll("person",
Executable { assertEquals("John", person.firstName) },
Executable { assertEquals("Doe", person.lastName) }
)