Skip to content

Commit c42a207

Browse files
authored
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
1 parent 56f7c50 commit c42a207

10 files changed

Lines changed: 11 additions & 91 deletions

File tree

codec/src/test/resources/io/netty/handler/codec/xml/sample-04.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,6 @@
210210

211211
<dependencies>
212212
<!-- Testing frameworks and related dependencies -->
213-
<dependency>
214-
<groupId>junit</groupId>
215-
<artifactId>junit</artifactId>
216-
<version>4.12</version>
217-
<scope>test</scope>
218-
</dependency>
219213
<dependency>
220214
<groupId>org.easymock</groupId>
221215
<artifactId>easymock</artifactId>

microbench/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,16 +185,6 @@
185185
<artifactId>junit-jupiter-engine</artifactId>
186186
<scope>compile</scope>
187187
</dependency>
188-
<dependency>
189-
<groupId>org.junit.vintage</groupId>
190-
<artifactId>junit-vintage-engine</artifactId>
191-
<scope>compile</scope>
192-
</dependency>
193-
<dependency>
194-
<groupId>junit</groupId>
195-
<artifactId>junit</artifactId>
196-
<scope>compile</scope>
197-
</dependency>
198188
<dependency>
199189
<groupId>org.openjdk.jmh</groupId>
200190
<artifactId>jmh-core</artifactId>

pom.xml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -886,18 +886,6 @@
886886
<version>${junit.version}</version>
887887
<scope>test</scope>
888888
</dependency>
889-
<dependency>
890-
<groupId>org.junit.vintage</groupId>
891-
<artifactId>junit-vintage-engine</artifactId>
892-
<version>${junit.version}</version>
893-
<scope>test</scope>
894-
</dependency>
895-
<dependency>
896-
<groupId>junit</groupId>
897-
<artifactId>junit</artifactId>
898-
<version>4.13.1</version>
899-
<scope>test</scope>
900-
</dependency>
901889
<dependency>
902890
<groupId>${project.groupId}</groupId>
903891
<artifactId>netty-build-common</artifactId>
@@ -1030,16 +1018,6 @@
10301018
<artifactId>junit-jupiter-params</artifactId>
10311019
<scope>test</scope>
10321020
</dependency>
1033-
<dependency>
1034-
<groupId>org.junit.vintage</groupId>
1035-
<artifactId>junit-vintage-engine</artifactId>
1036-
<scope>test</scope>
1037-
</dependency>
1038-
<dependency>
1039-
<groupId>junit</groupId>
1040-
<artifactId>junit</artifactId>
1041-
<scope>test</scope>
1042-
</dependency>
10431021
<dependency>
10441022
<groupId>${project.groupId}</groupId>
10451023
<artifactId>netty-build-common</artifactId>
@@ -1148,6 +1126,12 @@
11481126
<classQualifiedName>io.netty.util.internal.InternalThreadLocalMap</classQualifiedName>
11491127
<justification>Ignore cache padding.</justification>
11501128
</item>
1129+
<item>
1130+
<ignore>true</ignore>
1131+
<code>java.method.removed</code>
1132+
<old>method java.lang.String io.netty.testsuite.util.TestUtils::testMethodName(org.junit.rules.TestName)</old>
1133+
<justification>This should be test-only, and we're removing support for JUnit 4.</justification>
1134+
</item>
11511135
</differences>
11521136
</revapi.differences>
11531137
</analysisConfiguration>

testsuite-native/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@
4545
<groupId>org.junit.jupiter</groupId>
4646
<artifactId>junit-jupiter-engine</artifactId>
4747
</dependency>
48-
<dependency>
49-
<groupId>org.junit.vintage</groupId>
50-
<artifactId>junit-vintage-engine</artifactId>
51-
</dependency>
52-
<dependency>
53-
<groupId>junit</groupId>
54-
<artifactId>junit</artifactId>
55-
</dependency>
5648
</dependencies>
5749
<profiles>
5850
<profile>

testsuite-shading/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,6 @@
200200
<groupId>org.junit.jupiter</groupId>
201201
<artifactId>junit-jupiter-engine</artifactId>
202202
</dependency>
203-
<dependency>
204-
<groupId>org.junit.vintage</groupId>
205-
<artifactId>junit-vintage-engine</artifactId>
206-
</dependency>
207-
<dependency>
208-
<groupId>junit</groupId>
209-
<artifactId>junit</artifactId>
210-
</dependency>
211203
</dependencies>
212204
<profiles>
213205
<profile>

testsuite/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,6 @@
9494
<artifactId>junit-jupiter-params</artifactId>
9595
<scope>compile</scope>
9696
</dependency>
97-
<dependency>
98-
<groupId>org.junit.vintage</groupId>
99-
<artifactId>junit-vintage-engine</artifactId>
100-
<scope>compile</scope>
101-
</dependency>
102-
<dependency>
103-
<groupId>junit</groupId>
104-
<artifactId>junit</artifactId>
105-
<scope>compile</scope>
106-
</dependency>
10797
<dependency>
10898
<groupId>org.hamcrest</groupId>
10999
<artifactId>hamcrest-library</artifactId>

testsuite/src/main/java/io/netty/testsuite/transport/socket/DatagramUnicastIPv6Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import io.netty.channel.socket.InternetProtocolFamily;
1919
import io.netty.util.internal.PlatformDependent;
2020
import io.netty.util.internal.SuppressJava6Requirement;
21-
import org.junit.AssumptionViolatedException;
2221
import org.junit.jupiter.api.BeforeAll;
22+
import org.opentest4j.TestAbortedException;
2323

2424
import java.io.IOException;
2525
import java.net.StandardProtocolFamily;
@@ -38,7 +38,7 @@ public static void assumeIpv6Supported() {
3838
Channel channel = SelectorProvider.provider().openDatagramChannel(StandardProtocolFamily.INET6);
3939
channel.close();
4040
} catch (UnsupportedOperationException e) {
41-
throw new AssumptionViolatedException("IPv6 not supported", e);
41+
throw new TestAbortedException("IPv6 not supported", e);
4242
} catch (IOException ignore) {
4343
// Ignore
4444
}

testsuite/src/main/java/io/netty/testsuite/util/TestUtils.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import io.netty.util.internal.logging.InternalLogger;
2222
import io.netty.util.internal.logging.InternalLoggerFactory;
2323
import org.junit.jupiter.api.TestInfo;
24-
import org.junit.rules.TestName;
2524
import org.tukaani.xz.LZMA2Options;
2625
import org.tukaani.xz.XZOutputStream;
2726

@@ -120,17 +119,6 @@ public String apply(Method method) {
120119
return testMethodName;
121120
}
122121

123-
/**
124-
* Returns the method name of the current test.
125-
*/
126-
public static String testMethodName(TestName testName) {
127-
String testMethodName = testName.getMethodName();
128-
if (testMethodName.contains("[")) {
129-
testMethodName = testMethodName.substring(0, testMethodName.indexOf('['));
130-
}
131-
return testMethodName;
132-
}
133-
134122
public static void dump(String filenamePrefix) throws IOException {
135123

136124
ObjectUtil.checkNotNull(filenamePrefix, "filenamePrefix");

transport-native-unix-common-tests/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,5 @@
5454
<artifactId>junit-jupiter-engine</artifactId>
5555
<scope>compile</scope>
5656
</dependency>
57-
<dependency>
58-
<groupId>org.junit.vintage</groupId>
59-
<artifactId>junit-vintage-engine</artifactId>
60-
<scope>compile</scope>
61-
</dependency>
62-
<dependency>
63-
<groupId>junit</groupId>
64-
<artifactId>junit</artifactId>
65-
<scope>compile</scope>
66-
</dependency>
6757
</dependencies>
6858
</project>

transport-native-unix-common-tests/src/main/java/io/netty/channel/unix/tests/SocketTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import io.netty.channel.unix.Buffer;
1919
import io.netty.channel.unix.Socket;
20-
import org.junit.AssumptionViolatedException;
2120
import org.junit.jupiter.api.AfterEach;
2221
import org.junit.jupiter.api.BeforeEach;
2322
import org.junit.jupiter.api.Test;
23+
import org.opentest4j.TestAbortedException;
2424

2525
import java.io.IOException;
2626
import java.nio.ByteBuffer;
@@ -127,10 +127,10 @@ public void testRawOpt() throws IOException {
127127
}
128128

129129
protected int level() {
130-
throw new AssumptionViolatedException("Not supported");
130+
throw new TestAbortedException("Not supported");
131131
}
132132

133133
protected int optname() {
134-
throw new AssumptionViolatedException("Not supported");
134+
throw new TestAbortedException("Not supported");
135135
}
136136
}

0 commit comments

Comments
 (0)