diff --git a/api/pom.xml b/api/pom.xml
index ccbfb3ff..a54a37e7 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -77,8 +77,9 @@
false
Low
${project.basedir}/../spotbugs-exclude.xml
-
+
4.4.2.2
+ 5.9.0
@@ -94,9 +95,14 @@
1.0.0-M2
- junit
- junit
- 4.13.2
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.version}
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ ${junit.version}
@@ -107,8 +113,19 @@
jakarta.activation-api
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+ org.hamcrest
+ hamcrest
+ 2.2
test
diff --git a/api/src/test/java/jakarta/mail/URLNameTest.java b/api/src/test/java/jakarta/mail/URLNameTest.java
index 65f1c4c6..1da8e325 100644
--- a/api/src/test/java/jakarta/mail/URLNameTest.java
+++ b/api/src/test/java/jakarta/mail/URLNameTest.java
@@ -18,8 +18,8 @@
import java.net.URL;
-import org.junit.*;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.*;
+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 32dfdfc7..203efb29 100644
--- a/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java
+++ b/api/src/test/java/jakarta/mail/internet/AppleFileNamesTest.java
@@ -16,8 +16,8 @@
package jakarta.mail.internet;
-import org.junit.*;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test that the "mail.mime.applefilenames" System property
@@ -25,7 +25,7 @@
*/
public class AppleFileNamesTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.out.println("AppleFileNames");
System.setProperty("mail.mime.applefilenames", "true");
@@ -34,10 +34,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 72f5f75b..243473c5 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentDispositionNoStrictTest.java
@@ -16,16 +16,16 @@
package jakarta.mail.internet;
-import org.junit.*;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.*;
+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
*/
public class ContentDispositionNoStrictTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.setProperty("mail.mime.contentdisposition.strict", "false");
}
@@ -34,7 +34,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");
}
@@ -44,13 +44,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 a80ef848..65f97fe8 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentDispositionStrictTest.java
@@ -16,16 +16,15 @@
package jakarta.mail.internet;
-import org.junit.*;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
+import org.junit.jupiter.api.*;
+import static org.junit.jupiter.api.Assertions.fail;
/**
* Test the property that contols ContentDisposition non-strict mode
*/
public class ContentDispositionStrictTest {
- @BeforeClass
+ @BeforeAll
public static void before() {
System.setProperty("mail.mime.contentdisposition.strict", "true");
}
@@ -40,7 +39,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 c51ee82d..5fa77e09 100644
--- a/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java
+++ b/api/src/test/java/jakarta/mail/internet/ContentTypeTest.java
@@ -16,9 +16,9 @@
package jakarta.mail.internet;
-import org.junit.*;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import org.junit.jupiter.api.*;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
/**
* 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 21601449..4bd7b013 100644
--- a/api/src/test/java/jakarta/mail/internet/FoldTest.java
+++ b/api/src/test/java/jakarta/mail/internet/FoldTest.java
@@ -18,13 +18,12 @@
import java.io.*;
import java.util.*;
-import jakarta.mail.internet.MimeUtility;
+import java.util.stream.Stream;
-import org.junit.Test;
-import org.junit.Assert;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.api.Assertions;
/**
* Test header folding.
@@ -32,26 +31,14 @@
* @author Bill Shannon
*/
-@RunWith(Parameterized.class)
public class FoldTest {
- private String direction;
- private String orig;
- private String expect;
+ private static List testData;
- private static List