Skip to content

Commit

Permalink
Configure JUnit in a Gradle 9-compatible way
Browse files Browse the repository at this point in the history
* Explicitly declare correct classpath dependencies for JUnit
* Also, define the JUnit version in gradle.properties
  • Loading branch information
msgilligan committed Sep 28, 2023
1 parent f8cff5b commit 0b0762f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ subprojects {
dependencies {
implementation "org.slf4j:slf4j-api:${slf4jVersion}"

testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}")
testImplementation "org.apache.groovy:groovy:${groovyVersion}"
testImplementation("org.spockframework:spock-core:${spockVersion}") {
exclude module: "groovy-all"
}

testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly "net.bytebuddy:byte-buddy:1.14.8" // allows Spock to mock classes (in addition to interfaces)
testRuntimeOnly "org.objenesis:objenesis:3.3" // Allow Spock to mock classes with constructor arguments
testRuntimeOnly "org.slf4j:slf4j-jdk14:${slf4jVersion}" // Runtime implementation of slf4j
Expand Down Expand Up @@ -87,10 +89,6 @@ subprojects {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

tasks.withType(Test).configureEach {
useJUnitPlatform() // We're using Spock 2.0 and JUnit 5
}
}

apply from: 'gradle/idea.gradle'
Expand Down
6 changes: 3 additions & 3 deletions cj-btc-jsonrpc-integ-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ dependencies {
testImplementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
testImplementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"

testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.10.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.0"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"

testImplementation "org.apache.groovy:groovy:${groovyVersion}"
testImplementation ("org.apache.groovy:groovy-json:${groovyVersion}") {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ consensusjVersion = 0.7.0-SNAPSHOT
bitcoinjVersion = 0.17-alpha2
rxJavaVersion = 3.1.7
groovyVersion = 4.0.15
junitJupiterVersion = 5.10.0
spockVersion = 2.3-groovy-4.0
slf4jVersion = 2.0.9
jacksonVersion = 2.15.2
Expand Down

0 comments on commit 0b0762f

Please sign in to comment.