I have begun to migrate our tests to JUNIT 5.
In the gradle build file I have this configuration:
subprojects {
apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
}
dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testImplementation 'org.junit.platform:junit-platform-runner:1.4.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.4.2'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
}
Because the migration is not complete and some of our tests are using Junit 4 we have both Vintage and Jupiter dependencies.
In one of our test classes which is using Junit 5 we have one test, one disabled test and one inner class used by the test.
After running Gradle the test result looks like this:
UserToolTestSuite > JUnit Vintage.classMethod PASSED
UserToolTestSuite > TaskDefinitionContainerTest.Test to read taskDefinitions from a file PASSED
UserToolTestSuite > TaskDefinitionContainerTest.emptyClassList() SKIPPED
I wonder why Gradle is showing two passed tests while there is just one @Test annotation. Is it because of the inner class or combined Junit 4 and Junit 5 dependencies?