Use junit-foundation to break all tests using JUnit4 and projectTest helper
diff --git a/compiler/tests-mutes/mutes-junit4/build.gradle.kts b/compiler/tests-mutes/mutes-junit4/build.gradle.kts
index 6fb788f..b1361c2 100644
--- a/compiler/tests-mutes/mutes-junit4/build.gradle.kts
+++ b/compiler/tests-mutes/mutes-junit4/build.gradle.kts
@@ -6,6 +6,7 @@
dependencies {
api(libs.junit4)
implementation(project(":compiler:tests-mutes"))
+ api("com.nordstrom.tools:junit-foundation:17.1.1")
}
sourceSets {
diff --git a/compiler/tests-mutes/mutes-junit4/resources/META-INF/services/com.nordstrom.automation.junit.JUnitWatcher b/compiler/tests-mutes/mutes-junit4/resources/META-INF/services/com.nordstrom.automation.junit.JUnitWatcher
new file mode 100644
index 0000000..3dc2670
--- /dev/null
+++ b/compiler/tests-mutes/mutes-junit4/resources/META-INF/services/com.nordstrom.automation.junit.JUnitWatcher
@@ -0,0 +1,6 @@
+#
+# Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors.
+# Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+#
+
+org.jetbrains.kotlin.test.MuteWithDatabaseWatcher
diff --git a/compiler/tests-mutes/mutes-junit4/src/org/jetbrains/kotlin/test/MuteWithDatabaseWatcher.kt b/compiler/tests-mutes/mutes-junit4/src/org/jetbrains/kotlin/test/MuteWithDatabaseWatcher.kt
new file mode 100644
index 0000000..cbb3b05
--- /dev/null
+++ b/compiler/tests-mutes/mutes-junit4/src/org/jetbrains/kotlin/test/MuteWithDatabaseWatcher.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+package org.jetbrains.kotlin.test
+
+import com.nordstrom.automation.junit.MethodWatcher
+import org.junit.AssumptionViolatedException
+import org.junit.internal.runners.model.ReflectiveCallable
+import org.junit.runners.model.FrameworkMethod
+
+class MuteWithDatabaseWatcher : MethodWatcher<FrameworkMethod> {
+ override fun beforeInvocation(
+ runner: Any?,
+ child: FrameworkMethod?,
+ callable: ReflectiveCallable?,
+ ) {
+// println("NO EXECUTION SUPPRESSION")
+ //throw AssumptionViolatedException("Failure without execution")
+ }
+
+ override fun afterInvocation(
+ runner: Any?,
+ child: FrameworkMethod?,
+ callable: ReflectiveCallable?,
+ thrown: Throwable?,
+ ) {
+ //if (thrown == null) return
+
+ throw Exception("JUnit4 Expected failure")
+ //throw AssumptionViolatedException("Failure suppressed: ${thrown?.message}")
+ }
+
+ override fun supportedType(): Class<FrameworkMethod> = FrameworkMethod::class.java
+}
\ No newline at end of file
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 0741a19..c899b61 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -160,6 +160,18 @@
<sha256 value="f5759b7fcdfc83a525a036deedcbd32e5b536b625ebc282426f16ca137eb5902" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="ch.qos.logback" name="logback-classic" version="1.2.11">
+ <artifact name="logback-classic-1.2.11.jar">
+ <md5 value="e13679004cc76ad5792f275f04884fab" origin="Generated by Gradle"/>
+ <sha256 value="4d8e899621a3006c2f66e19feab002b11e6cfc5cb1854fc41f01532c00deb2aa" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
+ <component group="ch.qos.logback" name="logback-core" version="1.2.11">
+ <artifact name="logback-core-1.2.11.jar">
+ <md5 value="115da115b5e66ef64e774ec35af1fb1a" origin="Generated by Gradle"/>
+ <sha256 value="6ce1e9397be8298a2e99029f55f955c6fa3cef255171c554d0b9c201cffd0159" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="classworlds" name="classworlds" version="1.1-alpha-2">
<artifact name="classworlds-1.1-alpha-2.jar">
<md5 value="82cacb7d9724c4a4e4d20f004884d4da" origin="Generated by Gradle"/>
@@ -1522,6 +1534,24 @@
<sha256 value="26b0fc745ea051b57462be22a150c7600dbac6716b24cc60a5ecc0e8085c41a0" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="com.nordstrom.tools" name="java-utils" version="3.2.1">
+ <artifact name="java-utils-3.2.1.jar">
+ <md5 value="4abc4af1c6a101ed7bb7cd1354693518" origin="Generated by Gradle"/>
+ <sha256 value="e5901c2b4cef27192f536864b929b09f9a6d4bb71afd4ab4bd7c2d9712a7c2a5" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
+ <component group="com.nordstrom.tools" name="junit-foundation" version="17.1.1">
+ <artifact name="junit-foundation-17.1.1.jar">
+ <md5 value="3216c757784049dd1cbab2eff7b70a55" origin="Generated by Gradle"/>
+ <sha256 value="01b441f8f2aa4c05540f4008b06a21276e0355492c4a1290116b2e643e87fc02" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
+ <component group="com.nordstrom.tools" name="settings" version="3.0.5">
+ <artifact name="settings-3.0.5.jar">
+ <md5 value="4152a03f4b5f052e5cda376e693c80fd" origin="Generated by Gradle"/>
+ <sha256 value="170a8a1821d0a6765b774510563d3e9572696e04e831c9710535692e37a002b7" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="com.squareup" name="javapoet" version="1.10.0">
<artifact name="javapoet-1.10.0.jar">
<md5 value="58f542814fa3501790a57c212f20dafe" origin="Generated by Gradle"/>
@@ -1606,6 +1636,12 @@
<sha256 value="f76b85adb0c00721ae267b7cfde4da7f71d3121cc2160c9fc00c0c89f8c53c8a" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="commons-beanutils" name="commons-beanutils" version="1.9.4">
+ <artifact name="commons-beanutils-1.9.4.jar">
+ <md5 value="07dc532ee316fe1f2f0323e9bd2f8df4" origin="Generated by Gradle"/>
+ <sha256 value="7d938c81789028045c08c065e94be75fc280527620d5bd62b519d5838532368a" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="commons-codec" name="commons-codec" version="1.11">
<artifact name="commons-codec-1.11.jar">
<md5 value="567159b1ae257a43e1391a8f59d24cfe" origin="Generated by Gradle"/>
@@ -1618,6 +1654,12 @@
<sha256 value="f9f6cb103f2ddc3c99a9d80ada2ae7bf0685111fd6bffccb72033d1da4e6ff23" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="commons-collections" name="commons-collections" version="3.2.2">
+ <artifact name="commons-collections-3.2.2.jar">
+ <md5 value="f54a8510f834a1a57166970bfc982e94" origin="Generated by Gradle"/>
+ <sha256 value="eeeae917917144a68a741d4c0dff66aa5c5c5fd85593ff217bced3fc8ca783b8" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="commons-io" name="commons-io" version="2.16.1">
<artifact name="commons-io-2.16.1.jar">
<md5 value="ed8191a5a217940140001b0acfed18d9" origin="Generated by Gradle"/>
@@ -2582,6 +2624,12 @@
<sha256 value="07b9ca6e2f970cb03f4b25651df1f2fce271d491b44e0409827887786f692d4d" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="net.bytebuddy" name="byte-buddy" version="1.14.12">
+ <artifact name="byte-buddy-1.14.12.jar">
+ <md5 value="bf32ed474b27dc431b48bfef82d3c17f" origin="Generated by Gradle"/>
+ <sha256 value="970636134d61c183b19f8f58fa631e30d2f2abca344b37848a393cac7863dd70" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="net.bytebuddy" name="byte-buddy" version="1.14.9">
<artifact name="byte-buddy-1.14.9.jar">
<md5 value="48280c1c2676e942863de9b01e9cb03b" origin="Generated by Gradle"/>
@@ -2756,6 +2804,12 @@
<sha256 value="293d80f54b536b74095dcd7ea3cf0a29bbfc3402519281332495f4420d370d16" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="org.apache.commons" name="commons-configuration2" version="2.8.0">
+ <artifact name="commons-configuration2-2.8.0.jar">
+ <md5 value="4bb1f1ad26727cf5966554cb6b9eb073" origin="Generated by Gradle"/>
+ <sha256 value="e5c46e4b0b1acddbc96651838c19d3df70da92dfb5107a6e4c42cb92d3a300bd" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="org.apache.commons" name="commons-csv" version="1.11.0">
<artifact name="commons-csv-1.11.0.jar">
<md5 value="670327702ca6f22103531d20d140bc9e" origin="Generated by Gradle"/>
@@ -5484,6 +5538,12 @@
<sha256 value="e00ccdad5df7eb43fdee44232ef64602bf63807c2d133a7be83ba09fd49af26e" origin="Generated by Gradle"/>
</artifact>
</component>
+ <component group="pl.pragmatists" name="JUnitParams" version="1.1.1">
+ <artifact name="JUnitParams-1.1.1.jar">
+ <md5 value="954d9f5c8d8b97ecf3bdfb5b11fd706b" origin="Generated by Gradle"/>
+ <sha256 value="1be1aac16d424ce940d5407bef86656dc4ed5803c93e563cb1682ae07b591ecb" origin="Generated by Gradle"/>
+ </artifact>
+ </component>
<component group="webassembly" name="testsuite" version="18f8340">
<artifact name="testsuite-18f8340.zip">
<md5 value="d6ea2de35c54be9e8cfd74eebe475b62" origin="Generated by Gradle"/>
diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/tasks.kt b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/tasks.kt
index f7aedd5..c3cee1d 100644
--- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/tasks.kt
+++ b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/tasks.kt
@@ -160,6 +160,10 @@
project.dependencies {
"testImplementation"(project(":compiler:tests-mutes:mutes-junit5"))
}
+ } else {
+ project.dependencies {
+ "testImplementation"(project(":compiler:tests-mutes:mutes-junit4"))
+ }
}
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
.orNull?.toBoolean() != true
@@ -171,6 +175,12 @@
inputs.dir(File(rootDir, "build/ideaHomeForTests")).withPathSensitivity(PathSensitivity.RELATIVE)
muteWithDatabase()
+ if (jUnitMode == JUnitMode.JUnit4) {
+ jvmArgs(
+ "-javaagent:${classpath.find { it.name.contains("junit-foundation") }?.absolutePath ?:
+ error("junit-foundation not found in ${classpath.joinToString("\n")}")}"
+ )
+ }
doFirst {
if (jUnitMode == JUnitMode.JUnit5) return@doFirst