JAVA-11775 Remove usage of deprecated JUnitPlatform.class in junit-5-basics module

This commit is contained in:
anuragkumawat 2022-04-30 14:09:10 +05:30
parent 45085ce61c
commit a9eba4ed49
10 changed files with 12 additions and 32 deletions

View File

@ -15,12 +15,12 @@
</parent>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform.version}</version>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-migrationsupport</artifactId>

View File

@ -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

View File

@ -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());

View File

@ -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 {

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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 {
}

View File

@ -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 {