Skip to content

Commit

Permalink
Remove the last references to JUnit 4 (#12442)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chrisvest authored and normanmaurer committed Jun 3, 2022
1 parent 3bec8e0 commit 2afdf0b
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 85 deletions.
10 changes: 0 additions & 10 deletions microbench/pom.xml
Expand Up @@ -170,16 +170,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
22 changes: 0 additions & 22 deletions pom.xml
Expand Up @@ -779,18 +779,6 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-build-common</artifactId>
Expand Down Expand Up @@ -909,16 +897,6 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-build-common</artifactId>
Expand Down
8 changes: 0 additions & 8 deletions testsuite-native/pom.xml
Expand Up @@ -63,14 +63,6 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>

<profiles>
Expand Down
8 changes: 0 additions & 8 deletions testsuite-shading/pom.xml
Expand Up @@ -211,14 +211,6 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
10 changes: 0 additions & 10 deletions testsuite/pom.xml
Expand Up @@ -84,16 +84,6 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
Expand Down
Expand Up @@ -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;
Expand All @@ -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
}
Expand Down
12 changes: 0 additions & 12 deletions testsuite/src/main/java/io/netty5/testsuite/util/TestUtils.java
Expand Up @@ -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;

Expand Down Expand Up @@ -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");

Expand Down
10 changes: 0 additions & 10 deletions transport-native-unix-common-tests/pom.xml
Expand Up @@ -54,15 +54,5 @@
<artifactId>junit-jupiter-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
}

0 comments on commit 2afdf0b

Please sign in to comment.