diff --git a/testing-modules/junit-5-basics/pom.xml b/testing-modules/junit-5-basics/pom.xml index e6636e3239..e240efe514 100644 --- a/testing-modules/junit-5-basics/pom.xml +++ b/testing-modules/junit-5-basics/pom.xml @@ -15,12 +15,12 @@ - - org.junit.platform - junit-platform-runner - ${junit-platform.version} + + org.junit.platform + junit-platform-suite + ${junit-platform.version} test - + org.junit.jupiter junit-jupiter-migrationsupport diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/GreetingsUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/GreetingsUnitTest.java index a07162ceed..1ff21548b8 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/GreetingsUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/GreetingsUnitTest.java @@ -3,12 +3,9 @@ package com.baeldung; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; import com.baeldung.junit5.Greetings; -@RunWith(JUnitPlatform.class) public class GreetingsUnitTest { @Test diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java index 311c62f425..252bbdb2ce 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/JUnit5NewFeaturesUnitTest.java @@ -10,7 +10,6 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -//@RunWith(JUnitPlatform.class) public class JUnit5NewFeaturesUnitTest { private static final Logger log = Logger.getLogger(JUnit5NewFeaturesUnitTest.class.getName()); diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AnnotationTestExampleUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AnnotationTestExampleUnitTest.java index c2bbfd4d07..b324910ab7 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AnnotationTestExampleUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AnnotationTestExampleUnitTest.java @@ -6,12 +6,9 @@ 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; @Tag("annotations") @Tag("junit5") -@RunWith(JUnitPlatform.class) public class AnnotationTestExampleUnitTest { @Test public void shouldRaiseAnException() throws Exception { diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AssertionsExampleUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AssertionsExampleUnitTest.java index c35611aad1..14b1162ecf 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AssertionsExampleUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/AssertionsExampleUnitTest.java @@ -6,10 +6,7 @@ import java.util.List; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; -@RunWith(JUnitPlatform.class) public class AssertionsExampleUnitTest { @Test @Disabled diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeAllAndAfterAllAnnotationsUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeAllAndAfterAllAnnotationsUnitTest.java index 5181d54a46..68bb66657e 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeAllAndAfterAllAnnotationsUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeAllAndAfterAllAnnotationsUnitTest.java @@ -3,12 +3,9 @@ package com.baeldung.migration.junit5; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@RunWith(JUnitPlatform.class) public class BeforeAllAndAfterAllAnnotationsUnitTest { private static final Logger LOG = LoggerFactory.getLogger(BeforeAllAndAfterAllAnnotationsUnitTest.class); diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeEachAndAfterEachAnnotationsUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeEachAndAfterEachAnnotationsUnitTest.java index b2112ef2c3..283665798d 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeEachAndAfterEachAnnotationsUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/BeforeEachAndAfterEachAnnotationsUnitTest.java @@ -9,12 +9,9 @@ import java.util.List; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@RunWith(JUnitPlatform.class) public class BeforeEachAndAfterEachAnnotationsUnitTest { private static final Logger LOG = LoggerFactory.getLogger(BeforeEachAndAfterEachAnnotationsUnitTest.class); diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/RuleExampleUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/RuleExampleUnitTest.java index c67a57dcbd..5c878ef7d3 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/RuleExampleUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/migration/junit5/RuleExampleUnitTest.java @@ -1,14 +1,12 @@ package com.baeldung.migration.junit5; -import com.baeldung.migration.junit5.extensions.TraceUnitExtension; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.platform.runner.JUnitPlatform; -import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@RunWith(JUnitPlatform.class) +import com.baeldung.migration.junit5.extensions.TraceUnitExtension; + @ExtendWith(TraceUnitExtension.class) public class RuleExampleUnitTest { diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/suites/AllUnitTest.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/suites/AllUnitTest.java index 30b92ad428..b14440f1f2 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/suites/AllUnitTest.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/suites/AllUnitTest.java @@ -1,12 +1,13 @@ package com.baeldung.suites; -import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.ExcludePackages; 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") -// @SelectClasses({AssertionTest.class, AssumptionTest.class, ExceptionTest.class}) +@ExcludePackages("com.baeldung.suites") public class AllUnitTest { } + \ No newline at end of file diff --git a/testing-modules/junit-5-basics/src/test/java/com/baeldung/tags/EmployeeDAOTestSuite.java b/testing-modules/junit-5-basics/src/test/java/com/baeldung/tags/EmployeeDAOTestSuite.java index 783e5a81a2..cddb76381f 100644 --- a/testing-modules/junit-5-basics/src/test/java/com/baeldung/tags/EmployeeDAOTestSuite.java +++ b/testing-modules/junit-5-basics/src/test/java/com/baeldung/tags/EmployeeDAOTestSuite.java @@ -1,11 +1,8 @@ package com.baeldung.tags; -import org.junit.platform.runner.JUnitPlatform; import org.junit.platform.suite.api.IncludeTags; import org.junit.platform.suite.api.SelectPackages; -import org.junit.runner.RunWith; -@RunWith(JUnitPlatform.class) @SelectPackages("com.baeldung.tags") @IncludeTags("UnitTest") public class EmployeeDAOTestSuite {