Junit5: Kotlin extension function ArgumentsAccessor.getAs cannot be imported

Created on 14 Aug 2018  路  6Comments  路  Source: junit-team/junit5

Looks like https://github.com/junit-team/junit5/issues/1490 still doesn't work:

import org.junit.jupiter.params.aggregator.getAs

results in:

e: C:\testcase\src\test\kotlin\de\test\MyTest.kt: (7, 44): Unresolved reference: getAs

A testcase is attached.
testcase.zip

Jupiter Kotlin parameterized tests bug

Most helpful comment

Eureka! I think I found the root cause: https://discuss.kotlinlang.org/t/solved-extension-functions-not-available-when-exported-to-jar/4939

The JAR file does not include the META-INF/junit-jupiter-params.kotlin_module. Looks like it's lost during shadowing. Without it, extension functions don't work.

All 6 comments

Thanks for reporting! I was sure I verified it worked after we made the change but now I'm running into the same issue again. I think it's time for a real integration test for Kotlin extension functions.

@juergenzimmermann Any idea why it doesn't work?

Eureka! I think I found the root cause: https://discuss.kotlinlang.org/t/solved-extension-functions-not-available-when-exported-to-jar/4939

The JAR file does not include the META-INF/junit-jupiter-params.kotlin_module. Looks like it's lost during shadowing. Without it, extension functions don't work.

Sounds good:

_in progress_

Oops, wrong button. 馃檲

The JAR file does not include the META-INF/junit-jupiter-params.kotlin_module. Looks like it's lost during shadowing. Without it, extension functions don't work.

_Eureka!_

Nice detective work, @marcphilipp! 馃憦

Was this page helpful?
0 / 5 - 0 ratings