-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Copy link
Description
Given a Gradle project that looks like this (built with Temurin 24):
plugins {
kotlin("jvm") version "2.2.20"
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:6.0.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:6.0.0")
// testImplementation("org.junit.jupiter:junit-jupiter:5.14.0")
// testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.0")
}
tasks.test {
useJUnitPlatform()
}
And a test file like this:
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertDoesNotThrow
class Test {
@Test
fun test() {
assertDoesNotThrow {
error("but it does")
}
}
}
The following exception is produced:
failed to access class org.junit.jupiter.api.AssertDoesNotThrow from class Test (org.junit.jupiter.api.AssertDoesNotThrow and Test are in unnamed module of loader 'app')
java.lang.IllegalAccessError: failed to access class org.junit.jupiter.api.AssertDoesNotThrow from class Test (org.junit.jupiter.api.AssertDoesNotThrow and Test are in unnamed module of loader 'app')
at Test.test(Test.kt:17)
Swapping to the commented out dependencies with the previous releases produces the correct assertion failed error:
Unexpected exception thrown: java.lang.IllegalStateException: but it does
org.opentest4j.AssertionFailedError: Unexpected exception thrown: java.lang.IllegalStateException: but it does
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
at org.junit.jupiter.api.AssertDoesNotThrow.createAssertionFailedError(AssertDoesNotThrow.java:84)
at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:75)
at org.junit.jupiter.api.AssertDoesNotThrow.assertDoesNotThrow(AssertDoesNotThrow.java:58)
at org.junit.jupiter.api.Assertions.assertDoesNotThrow(Assertions.java:3259)
at Test.test(Test.kt:17)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
Caused by: java.lang.IllegalStateException: but it does
at Test.test(Test.kt:8)
... 3 more