From d105d1f34767e4329ca7ec9c26ccdc48f453ee58 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Sat, 30 Apr 2022 22:18:43 +0530 Subject: [PATCH] JAVA-11777 Remove usage of deprecated JUnitPlatform.class in junit5-migration module --- testing-modules/junit5-migration/pom.xml | 2 +- .../com/baeldung/junit5/AnnotationTestExampleUnitTest.java | 7 ++----- .../test/java/com/baeldung/junit5/RuleExampleUnitTest.java | 3 --- .../junit5vstestng/SelectClassesSuiteUnitTest.java | 5 ++--- .../junit5vstestng/SelectPackagesSuiteUnitTest.java | 5 ++--- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml index 3ea035c4f9..3720c1dc4a 100644 --- a/testing-modules/junit5-migration/pom.xml +++ b/testing-modules/junit5-migration/pom.xml @@ -22,7 +22,7 @@ org.junit.platform - junit-platform-runner + junit-platform-suite ${junit-platform.version} test diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java index 16de0be9d8..52d8f8f60a 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java @@ -1,17 +1,14 @@ package com.baeldung.junit5; +import java.time.Duration; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; - -import java.time.Duration; @Tag("annotations") @Tag("junit5") -@RunWith(JUnitPlatform.class) public class AnnotationTestExampleUnitTest { @Test public void shouldRaiseAnException() throws Exception { diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java index 297d0f1730..df509f561a 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java @@ -2,10 +2,7 @@ package com.baeldung.junit5; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; -@RunWith(JUnitPlatform.class) @ExtendWith(TraceUnitExtension.class) public class RuleExampleUnitTest { diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java index 7b4bd746bf..f307a75274 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectClassesSuiteUnitTest.java @@ -1,10 +1,9 @@ package com.baeldung.junit5vstestng; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectClasses; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectClasses({Class1UnitTest.class, Class2UnitTest.class}) public class SelectClassesSuiteUnitTest { diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java index 7378eafaa7..ef8756a2bb 100644 --- a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5vstestng/SelectPackagesSuiteUnitTest.java @@ -1,10 +1,9 @@ package com.baeldung.junit5vstestng; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; +import org.junit.platform.suite.api.Suite; -@RunWith(JUnitPlatform.class) +@Suite @SelectPackages({ "com.baeldung.java.suite.childpackage1", "com.baeldung.java.suite.childpackage2" }) public class SelectPackagesSuiteUnitTest {