Skip to content

Commit

Permalink
fix(tests): Introduce junit5 vintage engine for running junit4 test c…
Browse files Browse the repository at this point in the history
…ases over junit5 in fiat (#1025)

Spring boot 2.4.x removed JUnit5 vintage engine from spring-boot-starter-test.
[https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.4-Release-Notes#junit-5s-vintage-engine-removed-from-spring-boot-starter-test]
It is required for executing junit4 based test cases in fiat.
So, introducing junit-vintage-engine dependency in build.gradle, using testRuntimeOnly() as suggested in section 3.1 of https://junit.org/junit5/docs/5.6.2/user-guide/index.pdf

After applying this fix, coverage increased from 87 to 180 test case executions.
  • Loading branch information
j-sandy committed Mar 2, 2023
1 parent 03f1c53 commit 88a7216
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ subprojects {
}
minHeapSize = "512m"
maxHeapSize = "512m"
useJUnitPlatform()
}
tasks.withType(Javadoc) {
failOnError = false
Expand All @@ -69,6 +70,7 @@ subprojects {
testImplementation "org.springframework:spring-test"
testImplementation "org.hamcrest:hamcrest-core"
testRuntimeOnly "cglib:cglib-nodep"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
testRuntimeOnly "org.objenesis:objenesis"
}
}
Expand Down
4 changes: 0 additions & 4 deletions fiat-api/fiat-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,3 @@ dependencies {

testImplementation "org.slf4j:slf4j-api"
}

test {
useJUnitPlatform()
}
6 changes: 0 additions & 6 deletions fiat-roles/fiat-roles.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
* limitations under the License.
*/

test {
useJUnitPlatform {
includeEngines "junit-vintage", "junit-jupiter"
}
}

dependencies {
implementation project(":fiat-core")

Expand Down
6 changes: 0 additions & 6 deletions fiat-sql/fiat-sql.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,3 @@ dependencies {
// Only used for Initializing Datasource. For actual CRUD, test containers preferred.
testImplementation "com.h2database:h2"
}

test {
useJUnitPlatform {
includeEngines "junit-vintage", "junit-jupiter"
}
}

0 comments on commit 88a7216

Please sign in to comment.