From 2afdf0b35ba790cb8aa1f30e539e327ba5e5d076 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Thu, 2 Jun 2022 22:00:03 -0700 Subject: [PATCH] Remove the last references to JUnit 4 (#12442) Motivation: This completes our migration to JUnit 5. Modification: Remove all JUnit 4 dependencies. Replace or remove the last references to JUnit 4 types in the code. Add a revapi exception because a public TestUtils method was exposing JUnit 4 types and had to be removed. Result: No more JUnit 4 in our project. Fixes #10757 --- microbench/pom.xml | 10 --------- pom.xml | 22 ------------------- testsuite-native/pom.xml | 8 ------- testsuite-shading/pom.xml | 8 ------- testsuite/pom.xml | 10 --------- .../socket/DatagramUnicastIPv6Test.java | 4 ++-- .../io/netty5/testsuite/util/TestUtils.java | 12 ---------- transport-native-unix-common-tests/pom.xml | 10 --------- .../netty5/channel/unix/tests/SocketTest.java | 6 ++--- 9 files changed, 5 insertions(+), 85 deletions(-) diff --git a/microbench/pom.xml b/microbench/pom.xml index b5aa0235b8c..240dd5626ba 100644 --- a/microbench/pom.xml +++ b/microbench/pom.xml @@ -170,16 +170,6 @@ junit-jupiter-engine compile - - org.junit.vintage - junit-vintage-engine - compile - - - junit - junit - compile - org.openjdk.jmh jmh-core diff --git a/pom.xml b/pom.xml index e454662f13b..0be9375f568 100644 --- a/pom.xml +++ b/pom.xml @@ -779,18 +779,6 @@ ${junit.version} test - - org.junit.vintage - junit-vintage-engine - ${junit.version} - test - - - junit - junit - 4.13.1 - test - io.netty netty-build-common @@ -909,16 +897,6 @@ junit-jupiter-params test - - org.junit.vintage - junit-vintage-engine - test - - - junit - junit - test - io.netty netty-build-common diff --git a/testsuite-native/pom.xml b/testsuite-native/pom.xml index 51a504497d9..61d8c961554 100644 --- a/testsuite-native/pom.xml +++ b/testsuite-native/pom.xml @@ -63,14 +63,6 @@ org.junit.jupiter junit-jupiter-engine - - org.junit.vintage - junit-vintage-engine - - - junit - junit - diff --git a/testsuite-shading/pom.xml b/testsuite-shading/pom.xml index 47db3912a7a..62acf636f4e 100644 --- a/testsuite-shading/pom.xml +++ b/testsuite-shading/pom.xml @@ -211,14 +211,6 @@ org.junit.jupiter junit-jupiter-engine - - org.junit.vintage - junit-vintage-engine - - - junit - junit - diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 9ecd33e3992..2de23ca8bff 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -84,16 +84,6 @@ junit-jupiter-params compile - - org.junit.vintage - junit-vintage-engine - compile - - - junit - junit - compile - org.hamcrest hamcrest-library diff --git a/testsuite/src/main/java/io/netty5/testsuite/transport/socket/DatagramUnicastIPv6Test.java b/testsuite/src/main/java/io/netty5/testsuite/transport/socket/DatagramUnicastIPv6Test.java index 42941572c74..900baafd267 100644 --- a/testsuite/src/main/java/io/netty5/testsuite/transport/socket/DatagramUnicastIPv6Test.java +++ b/testsuite/src/main/java/io/netty5/testsuite/transport/socket/DatagramUnicastIPv6Test.java @@ -16,8 +16,8 @@ package io.netty5.testsuite.transport.socket; import io.netty5.channel.socket.InternetProtocolFamily; -import org.junit.AssumptionViolatedException; import org.junit.jupiter.api.BeforeAll; +import org.opentest4j.TestAbortedException; import java.io.IOException; import java.net.StandardProtocolFamily; @@ -32,7 +32,7 @@ public static void assumeIpv6Supported() { Channel channel = SelectorProvider.provider().openDatagramChannel(StandardProtocolFamily.INET6); channel.close(); } catch (UnsupportedOperationException e) { - throw new AssumptionViolatedException("IPv6 not supported", e); + throw new TestAbortedException("IPv6 not supported", e); } catch (IOException ignore) { // Ignore } diff --git a/testsuite/src/main/java/io/netty5/testsuite/util/TestUtils.java b/testsuite/src/main/java/io/netty5/testsuite/util/TestUtils.java index 172b0918d5d..71e47315f96 100644 --- a/testsuite/src/main/java/io/netty5/testsuite/util/TestUtils.java +++ b/testsuite/src/main/java/io/netty5/testsuite/util/TestUtils.java @@ -19,7 +19,6 @@ import io.netty5.util.internal.logging.InternalLogger; import io.netty5.util.internal.logging.InternalLoggerFactory; import org.junit.jupiter.api.TestInfo; -import org.junit.rules.TestName; import org.tukaani.xz.LZMA2Options; import org.tukaani.xz.XZOutputStream; @@ -78,17 +77,6 @@ public static String testMethodName(TestInfo testInfo) { return testMethodName; } - /** - * Returns the method name of the current test. - */ - public static String testMethodName(TestName testName) { - String testMethodName = testName.getMethodName(); - if (testMethodName.contains("[")) { - testMethodName = testMethodName.substring(0, testMethodName.indexOf('[')); - } - return testMethodName; - } - public static void dump(String filenamePrefix) throws IOException { requireNonNull(filenamePrefix, "filenamePrefix"); diff --git a/transport-native-unix-common-tests/pom.xml b/transport-native-unix-common-tests/pom.xml index e54e16b8c56..a62c29b5001 100644 --- a/transport-native-unix-common-tests/pom.xml +++ b/transport-native-unix-common-tests/pom.xml @@ -54,15 +54,5 @@ junit-jupiter-engine compile - - org.junit.vintage - junit-vintage-engine - compile - - - junit - junit - compile - diff --git a/transport-native-unix-common-tests/src/main/java/io/netty5/channel/unix/tests/SocketTest.java b/transport-native-unix-common-tests/src/main/java/io/netty5/channel/unix/tests/SocketTest.java index 3e6b885f98d..f24cb07ab46 100644 --- a/transport-native-unix-common-tests/src/main/java/io/netty5/channel/unix/tests/SocketTest.java +++ b/transport-native-unix-common-tests/src/main/java/io/netty5/channel/unix/tests/SocketTest.java @@ -17,10 +17,10 @@ import io.netty5.channel.unix.Buffer; import io.netty5.channel.unix.Socket; -import org.junit.AssumptionViolatedException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.opentest4j.TestAbortedException; import java.io.IOException; import java.nio.ByteBuffer; @@ -127,10 +127,10 @@ public void testRawOpt() throws IOException { } protected int level() { - throw new AssumptionViolatedException("Not supported"); + throw new TestAbortedException("Not supported"); } protected int optname() { - throw new AssumptionViolatedException("Not supported"); + throw new TestAbortedException("Not supported"); } }