diff --git a/api/pom.xml b/api/pom.xml
index 371ae689..91ae8a1a 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -77,11 +77,12 @@
false
Low
${project.basedir}/../spotbugs-exclude.xml
-
+
4.7.3.4
${project.version}
+ 5.10.1
@@ -97,9 +98,9 @@
2.0.1
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter
+ ${junit.version}
@@ -110,8 +111,14 @@
jakarta.activation-api
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter
+ test
+
+
+ org.hamcrest
+ hamcrest
+ 2.2
test
@@ -137,7 +144,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.0.0
+ 3.2.3
org.apache.maven.plugins
diff --git a/api/src/test/java/jakarta/mail/HeaderTest.java b/api/src/test/java/jakarta/mail/HeaderTest.java
index aefb08ec..5b7ee87a 100644
--- a/api/src/test/java/jakarta/mail/HeaderTest.java
+++ b/api/src/test/java/jakarta/mail/HeaderTest.java
@@ -16,12 +16,12 @@
package jakarta.mail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Date;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class HeaderTest {
diff --git a/api/src/test/java/jakarta/mail/URLNameTest.java b/api/src/test/java/jakarta/mail/URLNameTest.java
index bde6214d..ed3a6b63 100644
--- a/api/src/test/java/jakarta/mail/URLNameTest.java
+++ b/api/src/test/java/jakarta/mail/URLNameTest.java
@@ -16,11 +16,11 @@
package jakarta.mail;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.net.URL;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test the URLName class.
diff --git a/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java b/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java
index 93e887cd..93dd3985 100644
--- a/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java
+++ b/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java
@@ -16,11 +16,11 @@
package jakarta.mail.internet;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test that the "mail.mime.applefilenames" System property
@@ -28,7 +28,7 @@
*/
public class AppleFileNamesTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.out.println("AppleFileNames");
System.setProperty("mail.mime.applefilenames", "true");
@@ -37,10 +37,10 @@ public static void before() {
@Test
public void testProp() throws Exception {
ParameterList pl = new ParameterList("; filename=a b.txt");
- assertEquals(pl.get("filename"), "a b.txt");
+ assertEquals("a b.txt", pl.get("filename"));
}
- @AfterClass
+ @AfterAll
public static void after() {
// should be unnecessary
System.clearProperty("mail.mime.applefilenames");
diff --git a/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java b/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java
index 8e63539a..192903d3 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java
@@ -16,19 +16,19 @@
package jakarta.mail.internet;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.fail;
/**
- * Test the property that contols ContentDisposition non-strict mode
+ * Test the property that controls ContentDisposition non-strict mode
*/
public class ContentDispositionNoStrictTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.setProperty("mail.mime.contentdisposition.strict", "false");
}
@@ -37,7 +37,7 @@ public static void before() {
public void testDecode() throws Exception {
try {
ContentDisposition cd = new ContentDisposition("\"/non/standard/stuff/here.csv\"");
- assertNull("Content disposition must parse to null in non-strict mode", cd.getDisposition());
+ assertNull(cd.getDisposition(), "Content disposition must parse to null in non-strict mode");
} catch (ParseException px) {
fail("Exception must not be thrown in non-strict mode");
}
@@ -47,13 +47,13 @@ public void testDecode() throws Exception {
public void testDecodeWithParams() throws Exception {
try {
ContentDisposition cd = new ContentDisposition(" ; size=12345");
- assertNull("Content disposition must parse to null in non-strict mode", cd.getDisposition());
+ assertNull(cd.getDisposition(), "Content disposition must parse to null in non-strict mode");
} catch (ParseException px) {
fail("Exception must not be thrown in non-strict mode");
}
}
- @AfterClass
+ @AfterAll
public static void after() {
System.clearProperty("mail.mime.contentdisposition.strict");
}
diff --git a/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java b/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java
index 80f931d8..09354c0c 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java
@@ -16,18 +16,18 @@
package jakarta.mail.internet;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
/**
- * Test the property that contols ContentDisposition non-strict mode
+ * Test the property that controls ContentDisposition non-strict mode
*/
public class ContentDispositionStrictTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.setProperty("mail.mime.contentdisposition.strict", "true");
}
@@ -42,7 +42,7 @@ public void testDecode() throws Exception {
}
}
- @AfterClass
+ @AfterAll
public static void after() {
System.clearProperty("mail.mime.contentdisposition.strict");
}
diff --git a/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java b/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java
index 463b14de..d287bf9b 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java
@@ -16,10 +16,10 @@
package jakarta.mail.internet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test the ContentType class.
diff --git a/api/src/test/java/jakarta/mail/internet/FoldTest.java b/api/src/test/java/jakarta/mail/internet/FoldTest.java
index c42a8883..e847b330 100644
--- a/api/src/test/java/jakarta/mail/internet/FoldTest.java
+++ b/api/src/test/java/jakarta/mail/internet/FoldTest.java
@@ -16,18 +16,20 @@
package jakarta.mail.internet;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
+import java.util.stream.Stream;
+
+
+import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Test header folding.
@@ -35,26 +37,15 @@
* @author Bill Shannon
*/
-@RunWith(Parameterized.class)
public class FoldTest {
- private String direction;
- private String orig;
- private String expect;
- private static List