diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2024-02-20 10:18:25 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-20 20:02:38 +0000 |
commit | 2bfa1d52031005a5ead4d92a9451c260d3878cc0 (patch) | |
tree | 55a16d828eb63ea6a18a74e496328d9424f0f338 | |
parent | 9b925e5931796a04867eb9c524e67fae9da2671a (diff) | |
download | sonarqube-2bfa1d52031005a5ead4d92a9451c260d3878cc0.tar.gz sonarqube-2bfa1d52031005a5ead4d92a9451c260d3878cc0.zip |
SONAR-21643 Add support for Junit5
-rw-r--r-- | build.gradle | 7 | ||||
-rw-r--r-- | sonar-core/build.gradle | 9 | ||||
-rw-r--r-- | sonar-core/src/test/java/org/sonar/classloader/MaskTest.java | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/build.gradle b/build.gradle index e0162931140..819bfa4ed12 100644 --- a/build.gradle +++ b/build.gradle @@ -356,6 +356,13 @@ subprojects { dependency 'javax.servlet:javax.servlet-api:4.0.1' dependency 'javax.xml.bind:jaxb-api:2.3.1' dependency 'junit:junit:4.13.2' + // JUnit 5 + dependencySet(group: 'org.junit.jupiter', version: '5.10.2') { + entry 'junit-jupiter-api' + entry 'junit-jupiter-engine' + entry 'junit-jupiter-params' + entry 'junit-vintage-engine' + } dependency 'org.xmlunit:xmlunit-core:2.9.1' dependency 'org.xmlunit:xmlunit-matchers:2.9.1' dependency 'org.lz4:lz4-java:1.8.0' diff --git a/sonar-core/build.gradle b/sonar-core/build.gradle index 79045ab8c46..e68c4095e44 100644 --- a/sonar-core/build.gradle +++ b/sonar-core/build.gradle @@ -30,6 +30,7 @@ dependencies { testImplementation 'com.tngtech.java:junit-dataprovider' testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' testImplementation 'org.hamcrest:hamcrest-core' testImplementation 'org.mockito:mockito-core' testImplementation 'org.simpleframework:simple' @@ -37,6 +38,9 @@ dependencies { testImplementation project(':sonar-testing-harness') testCompileOnly 'com.google.code.findbugs:jsr305' + + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' + testRuntimeOnly 'org.junit.vintage:junit-vintage-engine' } // Used by sonar-db-core to run DB Unit Tests @@ -52,3 +56,8 @@ publishing { } } } + +test { + // Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle) + useJUnitPlatform() +} diff --git a/sonar-core/src/test/java/org/sonar/classloader/MaskTest.java b/sonar-core/src/test/java/org/sonar/classloader/MaskTest.java index abb793445ce..8868ab12089 100644 --- a/sonar-core/src/test/java/org/sonar/classloader/MaskTest.java +++ b/sonar-core/src/test/java/org/sonar/classloader/MaskTest.java @@ -19,7 +19,7 @@ */ package org.sonar.classloader; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; |