[*] Fix testing setup

This commit is contained in:
2025-03-01 10:05:49 +01:00
parent b466ccd577
commit 0eac7e42aa
2 changed files with 12 additions and 5 deletions

View File

@@ -17,10 +17,10 @@ repositories {
mavenCentral() mavenCentral()
} }
sourceSets { val testAgent = configurations.dependencyScope("mockitoAgent")
test { val testAgentClasspath = configurations.resolvable("testAgentClasspath") {
runtimeClasspath = main.get().runtimeClasspath isTransitive = false
} extendsFrom(testAgent.get())
} }
dependencies { dependencies {
@@ -38,16 +38,22 @@ dependencies {
implementation(libs.slf4j.api) implementation(libs.slf4j.api)
"localRuntimeOnly"(libs.slf4j.rt) "localRuntimeOnly"(libs.slf4j.rt)
testRuntimeOnly(libs.slf4j.rt)
testImplementation(platform(libs.junit.platform)) testImplementation(platform(libs.junit.platform))
testImplementation(libs.junit.core) testImplementation(libs.junit.core)
testRuntimeOnly(libs.junit.launcher)
testImplementation(libs.mockito) testImplementation(libs.mockito)
testAgent(libs.mockito)
testImplementation(libs.assertj) testImplementation(libs.assertj)
} }
tasks.test { tasks.test {
dependsOn(testAgentClasspath)
useJUnitPlatform() useJUnitPlatform()
jvmArgs(testAgentClasspath.get().files.map { file -> "-javaagent:${file.absolutePath}" })
systemProperties( systemProperties(
"junit.jupiter.execution.timeout.mode" to "disabled_on_debug", "junit.jupiter.execution.timeout.mode" to "disabled_on_debug",
"junit.jupiter.execution.timeout.testable.method.default" to "10s", "junit.jupiter.execution.timeout.testable.method.default" to "10s",

View File

@@ -4,7 +4,7 @@ asm = "9.7"
autoservice = "1.1.1" autoservice = "1.1.1"
java = "8" java = "8"
jetbrains-annotations = "26.0.1" jetbrains-annotations = "26.0.1"
junit = "5.11.2" junit = "5.12.0"
lombok = "1.18.34" lombok = "1.18.34"
mockito = "5.14.2" mockito = "5.14.2"
slf4j = "2.0.16" slf4j = "2.0.16"
@@ -18,6 +18,7 @@ autoservice-processor = { group = "com.google.auto.service", name = "auto-servic
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" } jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }
junit-platform = { group = "org.junit", name = "junit-bom", version.ref = "junit" } junit-platform = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
junit-core = { group = "org.junit.jupiter", name = "junit-jupiter" } junit-core = { group = "org.junit.jupiter", name = "junit-jupiter" }
junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" }
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" } lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }