After upgrade from JUnit 4 to JUnit 5 and upgrade from org.junit.Test to org.junit.jupiter.api.Test test call stops working if you directly run test methods via IntelliJ IDEA (running test by class works fine) for tests with brackets and backticks in Kotlin.
The workaround is to remove brackets from test names. See Kotlin examples below.
JUnit 4:
import org.junit.Test
class A {
@Test
fun `my (fun)` (){
}
}
works fine when you run this method from Idea directly
JUnit 5:
import org.junit.jupiter.api.Test
class A {
@Test
fun `my (fun)` (){
}
}
fails with exception due to braces "()" in the name:
org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to discover tests
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:189)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:168)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.junit.platform.commons.JUnitException: MethodSelector [className = 'dsf.A', methodName = 'my ', methodParameterTypes = 'fun'] resolution failed
I understand that an issue happens because API in JUnit changed and now IntelliJ passes parameters with brackets that are parsed to some new JUnitApi arguments.
But can someone help to understand the deep root of this problem. Is it a functional bug in Idea or it is a bug in JUnit?
PS Buggy Bonus:
