You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once opentest4j 1.3.0 is released and jupiter updates its dependency, the following patch will have to be applied: the build will fail because WithRootCauseKtTest.cannot initCause of AssertionFailedError will fail.
Subject: [PATCH] Remove dead code
---
Index: test/internal/build.gradle.kts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/test/internal/build.gradle.kts b/test/internal/build.gradle.kts--- a/test/internal/build.gradle.kts (revision 5d7687e245de8ab87426d309f629bfa44de1bc42)+++ b/test/internal/build.gradle.kts (date 1685627110287)@@ -19,6 +19,7 @@
api(libs.junit.api)
api(libs.junit.params)
runtimeOnly(libs.junit.engine)
+ api("org.opentest4j:opentest4j:1.3.0-RC1")
api(libs.hamcrest)
@@ -30,11 +31,3 @@
api(libs.jfixture.java)
}
--tasks.named<Test>("test") {- if (javaVersion.isJava9Compatible) {- // TODEL Java 16 vs AssertionFailedError https://github.com/ota4j-team/opentest4j/issues/70- // Example test: WithRootCauseKtTest.`registering a task preConfigures, but does not create it`- jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")- }-}
Index: test/internal/src/test/kotlin/net/twisterrob/test/WithRootCauseKtTest.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/test/internal/src/test/kotlin/net/twisterrob/test/WithRootCauseKtTest.kt b/test/internal/src/test/kotlin/net/twisterrob/test/WithRootCauseKtTest.kt--- a/test/internal/src/test/kotlin/net/twisterrob/test/WithRootCauseKtTest.kt (revision 5d7687e245de8ab87426d309f629bfa44de1bc42)+++ b/test/internal/src/test/kotlin/net/twisterrob/test/WithRootCauseKtTest.kt (date 1685627199920)@@ -70,20 +70,6 @@
}
}
- /**- * To verify the presence of the problem in- * [ota4j-team/opentest4j#5](https://github.com/ota4j-team/opentest4j/issues/5#issuecomment-940474063).- */- @Test- fun `cannot initCause of AssertionFailedError`() {- val ex = AssertionFailedError()- val cause = Throwable()-- assertThrows<IllegalStateException> {- ex.initCause(cause)- }- }-
@Test
fun `can add root cause to AssertionFailedError`() {
val ex = AssertionFailedError()
Index: test/internal/src/main/kotlin/net/twisterrob/test/withRootCause.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================diff --git a/test/internal/src/main/kotlin/net/twisterrob/test/withRootCause.kt b/test/internal/src/main/kotlin/net/twisterrob/test/withRootCause.kt--- a/test/internal/src/main/kotlin/net/twisterrob/test/withRootCause.kt (revision 5d7687e245de8ab87426d309f629bfa44de1bc42)+++ b/test/internal/src/main/kotlin/net/twisterrob/test/withRootCause.kt (date 1685626882629)@@ -1,17 +1,7 @@
package net.twisterrob.test
-import org.opentest4j.AssertionFailedError-
fun Throwable.withRootCause(cause: Throwable): Throwable {
require(cause !in generateSequence(this) { it.cause })
- val rootCause = generateSequence(this) { it.cause }.last()- if (rootCause is AssertionFailedError) {- // Workaround for https://github.com/ota4j-team/opentest4j/issues/5#issuecomment-940474063.- // Can't use constructor, because would need to rebuild the whole chain:- // AssertionFailedError(rootCause.message, rootCause.expected, rootCause.actual, cause)- val causeField = Throwable::class.java.getDeclaredField("cause").apply { isAccessible = true }- causeField.set(rootCause, rootCause)- }- rootCause.initCause(cause)+ generateSequence(this) { it.cause }.last().initCause(cause)
return this
}
The text was updated successfully, but these errors were encountered:
Once opentest4j 1.3.0 is released and jupiter updates its dependency, the following patch will have to be applied: the build will fail because
WithRootCauseKtTest.cannot initCause of AssertionFailedError
will fail.The text was updated successfully, but these errors were encountered: