chore: migrate junit 3/4 to junit 5 (#345)

* chore: migrate junit 3/4 to junit 5


Signed-off-by: Sandra Parsick <sandra@parsick.dev>
diff --git a/pom.xml b/pom.xml
index e9e335f..140c6d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,7 +95,6 @@
       <artifactId>commons-io</artifactId>
       <version>2.21.0</version>
     </dependency>
-
     <dependency>
       <groupId>org.hamcrest</groupId>
       <artifactId>hamcrest</artifactId>
@@ -103,9 +102,8 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.13.2</version>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/test/java/org/apache/maven/shared/utils/CaseTest.java b/src/test/java/org/apache/maven/shared/utils/CaseTest.java
index 04f0823..0e93ecd 100644
--- a/src/test/java/org/apache/maven/shared/utils/CaseTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/CaseTest.java
@@ -20,9 +20,11 @@
 
 import java.util.Locale;
 
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test case for character case changes, to precisely point the situations when character case comparison doesn't
@@ -33,7 +35,7 @@
  * @author Hervé Boutemy
  * @see <a href="http://sim.ivi.co/2011/07/trap-of-case-insensitive-string.html">Simple Smiles - Xuelei Fan's Blog</a>
  */
-public class CaseTest extends Assert {
+public class CaseTest {
     private static final Locale LOCALE_TURKISH = new Locale("tr");
 
     /** common ASCII 'i' */
@@ -56,7 +58,7 @@
 
     private static final Locale SAVED_DEFAULT_LOCALE = Locale.getDefault();
 
-    @AfterClass
+    @AfterAll
     public static void restoreDefaultLocale() {
         Locale.setDefault(SAVED_DEFAULT_LOCALE);
     }
@@ -68,32 +70,32 @@
     @Test
     public void testTurkishI() {
         // check common i and I
-        assertEquals("common lowercase i should have a dot", 'i', DOTTED_i);
-        assertEquals("common uppercase I should not have a dot", 'I', DOTLESS_I);
+        assertEquals('i', DOTTED_i, "common lowercase i should have a dot");
+        assertEquals('I', DOTLESS_I, "common uppercase I should not have a dot");
 
         @SuppressWarnings("LocalFinalVariableName")
         final String iIıİ = "iIıİ";
 
         // check source encoding doesn't wreak havoc */
-        assertEquals("misc i directly in (UTF-8) source", iIıİ, "" + DOTTED_i + DOTLESS_I + DOTLESS_i + DOTTED_I);
+        assertEquals(iIıİ, "" + DOTTED_i + DOTLESS_I + DOTLESS_i + DOTTED_I, "misc i directly in (UTF-8) source");
 
         // check toUpperCase and toLowerCase difference with turkish and english locales
         assertEquals(
-                "'iIıİ'.toUpperCase('tr')=='İIIİ'",
                 "" + DOTTED_I + DOTLESS_I + DOTLESS_I + DOTTED_I,
-                iIıİ.toUpperCase(LOCALE_TURKISH));
+                iIıİ.toUpperCase(LOCALE_TURKISH),
+                "'iIıİ'.toUpperCase('tr')=='İIIİ'");
         assertEquals(
-                "'iIıİ'.toLowerCase('tr')=='iııi'",
                 "" + DOTTED_i + DOTLESS_i + DOTLESS_i + DOTTED_i,
-                iIıİ.toLowerCase(LOCALE_TURKISH));
+                iIıİ.toLowerCase(LOCALE_TURKISH),
+                "'iIıİ'.toLowerCase('tr')=='iııi'");
         assertEquals(
-                "'iIıİ'.toUpperCase('en')=='IIIİ'",
                 "" + DOTLESS_I + DOTLESS_I + DOTLESS_I + DOTTED_I,
-                iIıİ.toUpperCase(Locale.ENGLISH));
+                iIıİ.toUpperCase(Locale.ENGLISH),
+                "'iIıİ'.toUpperCase('en')=='IIIİ'");
         String lower = iIıİ.toLowerCase(Locale.ENGLISH); // on some platforms, ends with extra COMBINED DOT ABOVE
         String expected =
                 "" + DOTTED_i + DOTTED_i + DOTLESS_i + DOTTED_i + (lower.length() > 4 ? COMBINING_DOT_ABOVE : "");
-        assertEquals("'iIıİ'.toLowerCase('en')=='iiıi'", expected, lower);
+        assertEquals(expected, lower, "'iIıİ'.toLowerCase('en')=='iiıi'");
 
         // check equalsIgnoreCase() , which has no locale
         for (int i = 0; i < iIıİ.length(); i++) {
@@ -105,7 +107,7 @@
             }
             String current = sb.toString();
 
-            assertTrue("'" + current + "'.equalsIgnoreCase('" + iIıİ + "')", current.equalsIgnoreCase(iIıİ));
+            assertTrue(current.equalsIgnoreCase(iIıİ), "'" + current + "'.equalsIgnoreCase('" + iIıİ + "')");
         }
     }
 
@@ -134,25 +136,25 @@
             }
 
             assertEquals(
-                    "'" + lower + "'.toUpperCase('" + locale.toString() + "')",
                     expectedToUpperCase,
-                    lower.toUpperCase(locale));
+                    lower.toUpperCase(locale),
+                    "'" + lower + "'.toUpperCase('" + locale.toString() + "')");
             assertEquals(
-                    "'" + upper + "'.toLowerCase('" + locale.toString() + "')",
                     expectedToLowerCase,
-                    upper.toLowerCase(locale));
+                    upper.toLowerCase(locale),
+                    "'" + upper + "'.toLowerCase('" + locale.toString() + "')");
 
             // check that toLowerCase on lower and toUpperCase on upper don't cause harm
-            assertEquals("'" + lower + "'.toLowerCase('" + locale + "')", lower, lower.toLowerCase(locale));
-            assertEquals("'" + upper + "'.toUpperCase('" + locale + "')", upper, upper.toUpperCase(locale));
+            assertEquals(lower, lower.toLowerCase(locale), "'" + lower + "'.toLowerCase('" + locale + "')");
+            assertEquals(upper, upper.toUpperCase(locale), "'" + upper + "'.toUpperCase('" + locale + "')");
 
             // check equalsIgnoreCase
             assertTrue(
-                    "'" + upper + "'.equalsIgnoreCase('" + expectedToLowerCase + "')",
-                    upper.equalsIgnoreCase(expectedToLowerCase));
+                    upper.equalsIgnoreCase(expectedToLowerCase),
+                    "'" + upper + "'.equalsIgnoreCase('" + expectedToLowerCase + "')");
             assertTrue(
-                    "'" + expectedToUpperCase + "'.equalsIgnoreCase('" + lower + "')",
-                    expectedToUpperCase.equalsIgnoreCase(lower));
+                    expectedToUpperCase.equalsIgnoreCase(lower),
+                    "'" + expectedToUpperCase + "'.equalsIgnoreCase('" + lower + "')");
         }
     }
 }
diff --git a/src/test/java/org/apache/maven/shared/utils/OsTest.java b/src/test/java/org/apache/maven/shared/utils/OsTest.java
index 08e6c39..b73238d 100644
--- a/src/test/java/org/apache/maven/shared/utils/OsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/OsTest.java
@@ -20,13 +20,13 @@
 
 import java.util.Set;
 
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Tests the 'Os' class which evaluates operation system specific settings.
@@ -38,7 +38,7 @@
     private String origOsArch;
     private String origOsVersion;
 
-    @Before
+    @BeforeEach
     public void setUp() {
         origOsName = System.getProperty("os.name");
         origOsArch = System.getProperty("os.arch");
@@ -50,7 +50,7 @@
         System.setProperty("os.version", "2.1.32");
     }
 
-    @After
+    @AfterEach
     public void tearDown() {
         // set the original OS settings again
         System.setProperty("os.name", origOsName);
@@ -63,88 +63,88 @@
         Os os = new Os();
         os.eval();
 
-        Assert.assertTrue(Os.isName(Os.FAMILY_OS2));
+        assertTrue(Os.isName(Os.FAMILY_OS2));
 
-        Assert.assertFalse(Os.isName(Os.FAMILY_DOS));
-        Assert.assertFalse(Os.isName(Os.FAMILY_MAC));
-        Assert.assertFalse(Os.isName(Os.FAMILY_NETWARE));
-        Assert.assertFalse(Os.isName(Os.FAMILY_OPENVMS));
-        Assert.assertFalse(Os.isName(Os.FAMILY_OS400));
-        Assert.assertFalse(Os.isName(Os.FAMILY_TANDEM));
-        Assert.assertFalse(Os.isName(Os.FAMILY_UNIX));
-        Assert.assertFalse(Os.isName(Os.FAMILY_WIN9X));
-        Assert.assertFalse(Os.isName(Os.FAMILY_WINDOWS));
-        Assert.assertFalse(Os.isName(Os.FAMILY_ZOS));
+        assertFalse(Os.isName(Os.FAMILY_DOS));
+        assertFalse(Os.isName(Os.FAMILY_MAC));
+        assertFalse(Os.isName(Os.FAMILY_NETWARE));
+        assertFalse(Os.isName(Os.FAMILY_OPENVMS));
+        assertFalse(Os.isName(Os.FAMILY_OS400));
+        assertFalse(Os.isName(Os.FAMILY_TANDEM));
+        assertFalse(Os.isName(Os.FAMILY_UNIX));
+        assertFalse(Os.isName(Os.FAMILY_WIN9X));
+        assertFalse(Os.isName(Os.FAMILY_WINDOWS));
+        assertFalse(Os.isName(Os.FAMILY_ZOS));
     }
 
     @Test
     public void testFamilyNames() {
-        Assert.assertEquals(Os.FAMILY_DOS, "dos");
-        Assert.assertEquals(Os.FAMILY_MAC, "mac");
-        Assert.assertEquals(Os.FAMILY_NETWARE, "netware");
-        Assert.assertEquals(Os.FAMILY_OPENVMS, "openvms");
-        Assert.assertEquals(Os.FAMILY_OS2, "os/2");
-        Assert.assertEquals(Os.FAMILY_OS400, "os/400");
-        Assert.assertEquals(Os.FAMILY_TANDEM, "tandem");
-        Assert.assertEquals(Os.FAMILY_UNIX, "unix");
-        Assert.assertEquals(Os.FAMILY_WIN9X, "win9x");
-        Assert.assertEquals(Os.FAMILY_WINDOWS, "windows");
-        Assert.assertEquals(Os.FAMILY_ZOS, "z/os");
+        assertEquals(Os.FAMILY_DOS, "dos");
+        assertEquals(Os.FAMILY_MAC, "mac");
+        assertEquals(Os.FAMILY_NETWARE, "netware");
+        assertEquals(Os.FAMILY_OPENVMS, "openvms");
+        assertEquals(Os.FAMILY_OS2, "os/2");
+        assertEquals(Os.FAMILY_OS400, "os/400");
+        assertEquals(Os.FAMILY_TANDEM, "tandem");
+        assertEquals(Os.FAMILY_UNIX, "unix");
+        assertEquals(Os.FAMILY_WIN9X, "win9x");
+        assertEquals(Os.FAMILY_WINDOWS, "windows");
+        assertEquals(Os.FAMILY_ZOS, "z/os");
     }
 
     @Test
     public void testGetValidFamilies() {
         Set<String> osFamilies = Os.getValidFamilies();
 
-        Assert.assertTrue("OsFamilies Set size", osFamilies.size() >= 11);
+        assertTrue(osFamilies.size() >= 11, "OsFamilies Set size");
 
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_DOS));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_MAC));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_NETWARE));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_OPENVMS));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_OS2));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_OS400));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_TANDEM));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_UNIX));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_WIN9X));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_WINDOWS));
-        Assert.assertTrue(osFamilies.contains(Os.FAMILY_ZOS));
+        assertTrue(osFamilies.contains(Os.FAMILY_DOS));
+        assertTrue(osFamilies.contains(Os.FAMILY_MAC));
+        assertTrue(osFamilies.contains(Os.FAMILY_NETWARE));
+        assertTrue(osFamilies.contains(Os.FAMILY_OPENVMS));
+        assertTrue(osFamilies.contains(Os.FAMILY_OS2));
+        assertTrue(osFamilies.contains(Os.FAMILY_OS400));
+        assertTrue(osFamilies.contains(Os.FAMILY_TANDEM));
+        assertTrue(osFamilies.contains(Os.FAMILY_UNIX));
+        assertTrue(osFamilies.contains(Os.FAMILY_WIN9X));
+        assertTrue(osFamilies.contains(Os.FAMILY_WINDOWS));
+        assertTrue(osFamilies.contains(Os.FAMILY_ZOS));
     }
 
     @Test
     public void testIsArch() {
-        assertThat("Arch is i386", Os.isArch("i386"), is(true));
+        assertTrue(Os.isArch("i386"), "Arch is i386");
 
-        assertThat("Os is not Mac", Os.isArch("x86_64"), is(false));
+        assertFalse(Os.isArch("x86_64"), "Os is not Mac");
     }
 
     @Test
     public void testIsFamily() {
-        assertThat("Family is os/2", Os.isFamily(Os.FAMILY_OS2), is(true));
+        assertTrue(Os.isFamily(Os.FAMILY_OS2), "Family is os/2");
 
-        assertThat("Family is not mac", Os.isFamily(Os.FAMILY_MAC), is(false));
+        assertFalse(Os.isFamily(Os.FAMILY_MAC), "Family is not mac");
     }
 
     @Test
     public void testIsName() {
-        assertThat("Name is os/2", Os.isName("os/2"), is(true));
+        assertTrue(Os.isName("os/2"), "Name is os/2");
 
-        assertThat("Name is not Mac OS X", Os.isName("Mac OS X"), is(false));
+        assertFalse(Os.isName("Mac OS X"), "Name is not Mac OS X");
     }
 
     @Test
     public void testIsValidFamily() {
-        assertThat("os/2 isValidFamily", Os.isValidFamily(Os.FAMILY_OS2), is(true));
+        assertTrue(Os.isValidFamily(Os.FAMILY_OS2), "os/2 isValidFamily");
 
-        assertThat("iPone != isValidFamily", Os.isValidFamily("iPhone"), is(false));
+        assertFalse(Os.isValidFamily("iPhone"), "iPone != isValidFamily");
     }
 
     @Test
     public void testIsVersion() {
-        assertThat("isVersion", Os.isVersion("2.1.32"), is(true));
+        assertTrue(Os.isVersion("2.1.32"), "isVersion");
 
-        assertThat("isVersion", Os.isVersion("2.1"), is(false));
+        assertFalse(Os.isVersion("2.1"), "isVersion");
 
-        assertThat("isVersion", Os.isVersion("4.5"), is(false));
+        assertFalse(Os.isVersion("4.5"), "isVersion");
     }
 }
diff --git a/src/test/java/org/apache/maven/shared/utils/PathToolTest.java b/src/test/java/org/apache/maven/shared/utils/PathToolTest.java
index c46a5cd..4cba8c0 100644
--- a/src/test/java/org/apache/maven/shared/utils/PathToolTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/PathToolTest.java
@@ -20,14 +20,12 @@
 
 import java.io.File;
 
-import org.hamcrest.CoreMatchers;
-import org.junit.Assume;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 /**
  * Test the {@link PathTool} class.
@@ -36,88 +34,87 @@
  */
 public class PathToolTest {
 
-    @Rule
-    public TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir
+    private File tempFolder;
 
     @Test
     // Keep in sync with testGetRelativeFilePathWindows()
     public void testGetRelativeFilePathNonWindows() {
-        Assume.assumeThat(File.separatorChar, is('/'));
+        assumeTrue(File.separatorChar == '/');
 
-        assertThat(PathTool.getRelativeFilePath(null, null), is(""));
+        assertEquals("", PathTool.getRelativeFilePath(null, null));
 
-        assertThat(PathTool.getRelativeFilePath(null, "/usr/local/java/bin"), is(""));
+        assertEquals("", PathTool.getRelativeFilePath(null, "/usr/local/java/bin"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local", null), is(""));
+        assertEquals("", PathTool.getRelativeFilePath("/usr/local", null));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local", "/usr/local/java/bin"), is("java/bin"));
+        assertEquals("java/bin", PathTool.getRelativeFilePath("/usr/local", "/usr/local/java/bin"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local", "/usr/local/java/bin/"), is("java/bin/"));
+        assertEquals("java/bin/", PathTool.getRelativeFilePath("/usr/local", "/usr/local/java/bin/"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local/java/bin", "/usr/local/"), is("../../"));
+        assertEquals("../../", PathTool.getRelativeFilePath("/usr/local/java/bin", "/usr/local/"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local/", "/usr/local/java/bin/java.sh"), is("java/bin/java.sh"));
+        assertEquals("java/bin/java.sh", PathTool.getRelativeFilePath("/usr/local/", "/usr/local/java/bin/java.sh"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local/java/bin/java.sh", "/usr/local/"), is("../../../"));
+        assertEquals("../../../", PathTool.getRelativeFilePath("/usr/local/java/bin/java.sh", "/usr/local/"));
 
-        assertThat(PathTool.getRelativeFilePath("/usr/local/", "/bin"), is("../../bin"));
+        assertEquals("../../bin", PathTool.getRelativeFilePath("/usr/local/", "/bin"));
 
-        assertThat(PathTool.getRelativeFilePath("/bin", "/usr/local/"), is("../usr/local/"));
+        assertEquals("../usr/local/", PathTool.getRelativeFilePath("/bin", "/usr/local/"));
     }
 
     @Test
     // Keep in sync with testGetRelativeFilePathNonWindows()
     public void testGetRelativeFilePathWindows() {
-        Assume.assumeThat(File.separatorChar, is('\\'));
+        assumeTrue(File.separatorChar == '\\');
 
-        assertThat(PathTool.getRelativeFilePath(null, null), is(""));
+        assertEquals("", PathTool.getRelativeFilePath(null, null));
 
-        assertThat(PathTool.getRelativeFilePath(null, "c:\\usr\\local\\java\\bin"), is(""));
+        assertEquals("", PathTool.getRelativeFilePath(null, "c:\\usr\\local\\java\\bin"));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\usr\\local", null), is(""));
+        assertEquals("", PathTool.getRelativeFilePath("c:\\usr\\local", null));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\usr\\local", "c:\\usr\\local\\java\\bin"), is("java\\bin"));
+        assertEquals("java\\bin", PathTool.getRelativeFilePath("c:\\usr\\local", "c:\\usr\\local\\java\\bin"));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\usr\\local", "c:\\usr\\local\\java\\bin\\"), is("java\\bin\\"));
+        assertEquals("java\\bin\\", PathTool.getRelativeFilePath("c:\\usr\\local", "c:\\usr\\local\\java\\bin\\"));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\usr\\local\\java\\bin", "c:\\usr\\local\\"), is("..\\..\\"));
+        assertEquals("..\\..\\", PathTool.getRelativeFilePath("c:\\usr\\local\\java\\bin", "c:\\usr\\local\\"));
 
-        assertThat(
-                PathTool.getRelativeFilePath("c:\\usr\\local\\", "c:\\usr\\local\\java\\bin\\java.sh"),
-                is("java\\bin\\java.sh"));
+        assertEquals(
+                "java\\bin\\java.sh",
+                PathTool.getRelativeFilePath("c:\\usr\\local\\", "c:\\usr\\local\\java\\bin\\java.sh"));
 
-        assertThat(
-                PathTool.getRelativeFilePath("c:\\usr\\local\\java\\bin\\java.sh", "c:\\usr\\local\\"),
-                is("..\\..\\..\\"));
+        assertEquals(
+                "..\\..\\..\\", PathTool.getRelativeFilePath("c:\\usr\\local\\java\\bin\\java.sh", "c:\\usr\\local\\"));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\usr\\local\\", "c:\\bin"), is("..\\..\\bin"));
+        assertEquals("..\\..\\bin", PathTool.getRelativeFilePath("c:\\usr\\local\\", "c:\\bin"));
 
-        assertThat(PathTool.getRelativeFilePath("c:\\bin", "c:\\usr\\local\\"), is("..\\usr\\local\\"));
+        assertEquals("..\\usr\\local\\", PathTool.getRelativeFilePath("c:\\bin", "c:\\usr\\local\\"));
     }
 
     @Test
     public void testGetRelativePath2Parm() {
-        assertThat(PathTool.getRelativePath(null, null), is(""));
+        assertEquals("", PathTool.getRelativePath(null, null));
 
-        assertThat(PathTool.getRelativePath(null, "/usr/local/java/bin"), is(""));
+        assertEquals("", PathTool.getRelativePath(null, "/usr/local/java/bin"));
 
-        assertThat(PathTool.getRelativePath("/usr/local/", null), is(""));
+        assertEquals("", PathTool.getRelativePath("/usr/local/", null));
 
-        assertThat(PathTool.getRelativePath("/usr/local/", "/usr/local/java/bin"), is(".."));
+        assertEquals("..", PathTool.getRelativePath("/usr/local/", "/usr/local/java/bin"));
 
-        assertThat(PathTool.getRelativePath("/usr/local/", "/usr/local/java/bin/java.sh"), is("../.."));
+        assertEquals("../..", PathTool.getRelativePath("/usr/local/", "/usr/local/java/bin/java.sh"));
 
-        assertThat(PathTool.getRelativePath("/usr/local/java/bin/java.sh", "/usr/local/"), is(""));
+        assertEquals("", PathTool.getRelativePath("/usr/local/java/bin/java.sh", "/usr/local/"));
     }
 
     @Test
     public void testUppercaseDrive() {
-        assertThat(PathTool.uppercaseDrive(null), CoreMatchers.nullValue());
+        assertNull(PathTool.uppercaseDrive(null));
 
-        assertThat(PathTool.uppercaseDrive("d:"), is("D:"));
+        assertEquals("D:", PathTool.uppercaseDrive("d:"));
 
-        assertThat(PathTool.uppercaseDrive("D:"), is("D:"));
+        assertEquals("D:", PathTool.uppercaseDrive("D:"));
 
-        assertThat(PathTool.uppercaseDrive("/notadrive"), is("/notadrive"));
+        assertEquals("/notadrive", PathTool.uppercaseDrive("/notadrive"));
     }
 }
diff --git a/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java
index 5ea2f47..64dc97c 100644
--- a/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java
@@ -32,9 +32,8 @@
 import java.net.URL;
 import java.util.Properties;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
@@ -46,8 +45,8 @@
     @Target(ElementType.METHOD)
     @interface NeedsTemporaryFolder {}
 
-    @Rule
-    public TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir
+    private File tempFolder;
 
     @Test
     @SuppressWarnings("deprecation")
@@ -101,8 +100,8 @@
     @NeedsTemporaryFolder
     @SuppressWarnings("deprecation")
     public void loadEmptyFile() throws Exception {
-        assertThat(PropertyUtils.loadProperties(tempFolder.newFile("empty")), is(new Properties()));
-        assertThat(PropertyUtils.loadOptionalProperties(tempFolder.newFile("optional")), is(new Properties()));
+        assertThat(PropertyUtils.loadProperties(newFile(tempFolder, "empty")), is(new Properties()));
+        assertThat(PropertyUtils.loadOptionalProperties(newFile(tempFolder, "optional")), is(new Properties()));
     }
 
     @Test
@@ -110,11 +109,13 @@
     @SuppressWarnings("deprecation")
     public void loadEmptyURL() throws Exception {
         assertThat(
-                PropertyUtils.loadProperties(tempFolder.newFile("empty").toURI().toURL()), is(new Properties()));
+                PropertyUtils.loadProperties(
+                        newFile(tempFolder, "empty").toURI().toURL()),
+                is(new Properties()));
 
         assertThat(
                 PropertyUtils.loadOptionalProperties(
-                        tempFolder.newFile("optional").toURI().toURL()),
+                        newFile(tempFolder, "optional").toURI().toURL()),
                 is(new Properties()));
     }
 
@@ -135,7 +136,7 @@
     @NeedsTemporaryFolder
     @SuppressWarnings("deprecation")
     public void loadValidFile() throws IOException {
-        File valid = tempFolder.newFile("valid");
+        File valid = newFile(tempFolder, "valid");
         Properties value = new Properties();
         value.setProperty("a", "b");
         try (OutputStream out = new FileOutputStream(valid)) {
@@ -149,7 +150,7 @@
     @NeedsTemporaryFolder
     @SuppressWarnings("deprecation")
     public void loadValidURL() throws IOException {
-        File valid = tempFolder.newFile("valid");
+        File valid = newFile(tempFolder, "valid");
         Properties value = new Properties();
         value.setProperty("a", "b");
         try (OutputStream out = new FileOutputStream(valid)) {
@@ -158,4 +159,10 @@
             assertThat(PropertyUtils.loadOptionalProperties(valid.toURI().toURL()), is(value));
         }
     }
+
+    private static File newFile(File parent, String child) throws IOException {
+        File result = new File(parent, child);
+        result.createNewFile();
+        return result;
+    }
 }
diff --git a/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java
index 1d1abb4..e5c7124 100644
--- a/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java
@@ -23,11 +23,12 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Test the {@link StringUtils} class.
@@ -36,14 +37,16 @@
  */
 public class StringUtilsTest {
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testAbbreviateNPE() {
-        assertThat(StringUtils.abbreviate(null, 10), nullValue());
+        assertThrows(NullPointerException.class, () -> assertThat(StringUtils.abbreviate(null, 10), nullValue()));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testAbbreviateMinLength() {
-        assertThat(StringUtils.abbreviate("This is a longtext", 3), is("T"));
+        assertThrows(
+                IllegalArgumentException.class,
+                () -> assertThat(StringUtils.abbreviate("This is a longtext", 3), is("T")));
     }
 
     @Test
@@ -53,14 +56,16 @@
         assertThat(StringUtils.abbreviate("This is a longtext", 50), is("This is a longtext"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testAbbreviateOffsetNPE() {
-        assertThat(StringUtils.abbreviate(null, 10, 20), nullValue());
+        assertThrows(NullPointerException.class, () -> assertThat(StringUtils.abbreviate(null, 10, 20), nullValue()));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testAbbreviateOffsetMinLength() {
-        assertThat(StringUtils.abbreviate("This is a longtext", 10, 3), is("T"));
+        assertThrows(
+                IllegalArgumentException.class,
+                () -> assertThat(StringUtils.abbreviate("This is a longtext", 10, 3), is("T")));
     }
 
     @Test
@@ -72,9 +77,9 @@
         assertThat(StringUtils.abbreviate("This is a longtext", 50, 20), is("This is a longtext"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testAddAndDeHumpNPE() {
-        StringUtils.addAndDeHump(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.addAndDeHump(null));
     }
 
     @Test
@@ -100,9 +105,10 @@
         assertThat(StringUtils.capitaliseAllWords("start all big"), is("Start All Big"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testCapitalizeFirstLetterNPE() {
-        assertThat(StringUtils.capitalizeFirstLetter(null), nullValue());
+        assertThrows(
+                NullPointerException.class, () -> assertThat(StringUtils.capitalizeFirstLetter(null), nullValue()));
     }
 
     @Test
@@ -114,9 +120,9 @@
         assertThat(StringUtils.capitalizeFirstLetter("start all big"), is("Start all big"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testCenterNPE() {
-        StringUtils.center(null, 20);
+        assertThrows(NullPointerException.class, () -> StringUtils.center(null, 20));
     }
 
     @Test
@@ -128,9 +134,9 @@
         assertThat(StringUtils.center("        centerMe", 20), is("          centerMe  "));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testCenterDelimNPE() {
-        StringUtils.center(null, 20, "*");
+        assertThrows(NullPointerException.class, () -> StringUtils.center(null, 20, "*"));
     }
 
     @Test
@@ -142,9 +148,9 @@
         assertThat(StringUtils.center("        centerMe", 20, "*"), is("**        centerMe**"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChompNPE() {
-        StringUtils.chomp(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.chomp(null));
     }
 
     @Test
@@ -158,9 +164,9 @@
         assertThat(StringUtils.chomp("dings\nbums\ndongs"), is("dings\nbums"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChompDelimNPE() {
-        StringUtils.chomp(null, "+");
+        assertThrows(NullPointerException.class, () -> StringUtils.chomp(null, "+"));
     }
 
     @Test
@@ -174,9 +180,9 @@
         assertThat(StringUtils.chomp("dings+bums+dongs", "+"), is("dings+bums"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChompLastNPE() {
-        StringUtils.chompLast(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.chompLast(null));
     }
 
     @Test
@@ -192,9 +198,9 @@
         assertThat(StringUtils.chompLast("dings\nbums\ndongs\n"), is("dings\nbums\ndongs"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChompLastDelimNPE() {
-        StringUtils.chompLast(null, "+");
+        assertThrows(NullPointerException.class, () -> StringUtils.chompLast(null, "+"));
     }
 
     @Test
@@ -210,9 +216,9 @@
         assertThat(StringUtils.chompLast("dings+bums+dongs+", "+"), is("dings+bums+dongs"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChopNPE() {
-        StringUtils.chop(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.chop(null));
     }
 
     @Test
@@ -228,9 +234,9 @@
         assertThat(StringUtils.chop("dings\n\r"), is("dings\n"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testChopNewlineNPE() {
-        StringUtils.chopNewline(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.chopNewline(null));
     }
 
     @Test
@@ -257,9 +263,9 @@
         assertThat(StringUtils.clean("  dings \n  "), is("dings"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testConcatenateNPE() {
-        StringUtils.concatenate(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.concatenate(null));
     }
 
     @Test
@@ -299,14 +305,14 @@
         assertThat(StringUtils.contains("string", "R"), is(false));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testCountMatchesNPE() {
-        StringUtils.countMatches(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.countMatches(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testCountMatchesNPE2() {
-        StringUtils.countMatches("this is it", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.countMatches("this is it", null));
     }
 
     @Test
@@ -332,9 +338,9 @@
         assertThat(StringUtils.defaultString("dings", "defaultValue"), is("dings"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDeleteWhitespaceNPE() {
-        StringUtils.deleteWhitespace(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.deleteWhitespace(null));
     }
 
     @Test
@@ -348,19 +354,19 @@
         assertThat(StringUtils.deleteWhitespace("\n  dings \t "), is("dings"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceNPE() {
-        StringUtils.difference(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.difference(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceNPE2() {
-        StringUtils.difference(null, "another");
+        assertThrows(NullPointerException.class, () -> StringUtils.difference(null, "another"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceNPE3() {
-        StringUtils.difference("this", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.difference("this", null));
     }
 
     @Test
@@ -372,19 +378,19 @@
         assertThat(StringUtils.difference("I am human", "I AM a robot"), is("AM a robot"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceAtNPE() {
-        StringUtils.differenceAt(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.differenceAt(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceAtNPE2() {
-        StringUtils.differenceAt("test", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.differenceAt("test", null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testDifferenceAtNPE3() {
-        StringUtils.differenceAt(null, "test");
+        assertThrows(NullPointerException.class, () -> StringUtils.differenceAt(null, "test"));
     }
 
     @Test
@@ -439,9 +445,9 @@
         assertThat(StringUtils.equalsIgnoreCase("dings", "diNGs"), is(true));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testEscapeNPE() {
-        StringUtils.escape(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.escape(null));
     }
 
     @Test
@@ -465,19 +471,19 @@
         assertThat(StringUtils.escape("dings\bbums", new char[] {'\t', '\b'}, '+'), is("dings+\bbums"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetChompNPE1() {
-        StringUtils.getChomp(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.getChomp(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetChompNPE2() {
-        StringUtils.getChomp("dings", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.getChomp("dings", null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetChompNPE3() {
-        StringUtils.getChomp(null, "dings");
+        assertThrows(NullPointerException.class, () -> StringUtils.getChomp(null, "dings"));
     }
 
     @Test
@@ -489,9 +495,11 @@
         assertThat(StringUtils.getChomp("dingsbums", "-"), is(""));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetNestedStringNPE() {
-        assertThat(StringUtils.getNestedString("  +dings+ ", null), nullValue());
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(StringUtils.getNestedString("  +dings+ ", null), nullValue()));
     }
 
     @Test
@@ -503,14 +511,18 @@
         assertThat(StringUtils.getNestedString("  +dings+ ", "not"), nullValue());
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetNestedString2NPE1() {
-        assertThat(StringUtils.getNestedString("  +dings+ ", null, null), nullValue());
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(StringUtils.getNestedString("  +dings+ ", null, null), nullValue()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetNestedString2NPE2() {
-        assertThat(StringUtils.getNestedString("  +dings+ ", null, "neither"), nullValue());
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(StringUtils.getNestedString("  +dings+ ", null, "neither"), nullValue()));
     }
 
     @Test
@@ -524,14 +536,14 @@
         assertThat(StringUtils.getNestedString("  +dings+ ", "not", "neither"), nullValue());
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetPrechompNPE1() {
-        StringUtils.getPrechomp(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.getPrechomp(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testGetPrechompNPE2() {
-        StringUtils.getPrechomp(null, "bums");
+        assertThrows(NullPointerException.class, () -> StringUtils.getPrechomp(null, "bums"));
     }
 
     @Test
@@ -552,14 +564,14 @@
         assertThat(StringUtils.indexOfAny("dings bums dongs", new String[] {"knuff", "bums"}), is(6));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testInterpolateNPE() {
-        StringUtils.interpolate(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.interpolate(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testInterpolateNPE2() {
-        StringUtils.interpolate("This ${text} will get replaced", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.interpolate("This ${text} will get replaced", null));
     }
 
     @Test
@@ -746,9 +758,9 @@
         assertThat(StringUtils.isWhitespace("  \n "), is(true));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testJoinArrayNPE() {
-        StringUtils.join((Object[]) null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.join((Object[]) null, null));
     }
 
     @Test
@@ -760,9 +772,9 @@
         assertThat(StringUtils.join(new Object[] {"a", "b", "c"}, "__"), is("a__b__c"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testJoinIteratorNPE() {
-        StringUtils.join((Iterator<?>) null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.join((Iterator<?>) null, null));
     }
 
     @Test
@@ -791,9 +803,9 @@
         assertThat(StringUtils.lastIndexOfAny("dings bums boms", new String[] {"nix", "da"}), is(-1));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testLeftIAE() {
-        StringUtils.left(null, -1);
+        assertThrows(IllegalArgumentException.class, () -> StringUtils.left(null, -1));
     }
 
     @Test
@@ -807,9 +819,9 @@
         assertThat(StringUtils.left("dingsbums", 0), is(""));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testLeftPad1NPE() {
-        StringUtils.leftPad(null, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.leftPad(null, 0));
     }
 
     @Test
@@ -821,19 +833,19 @@
         assertThat(StringUtils.leftPad("dings", 10), is("     dings"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testLeftPad2NPE1() {
-        StringUtils.leftPad(null, 0, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.leftPad(null, 0, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testLeftPad2NPE2() {
-        StringUtils.leftPad("dings", 0, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.leftPad("dings", 0, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testLeftPad2NPE3() {
-        StringUtils.leftPad(null, 0, "*");
+        assertThrows(NullPointerException.class, () -> StringUtils.leftPad(null, 0, "*"));
     }
 
     @Test
@@ -854,9 +866,9 @@
         assertThat(StringUtils.lowerCase(""), is(""));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testLowerCaseFirstLetterNPE() {
-        StringUtils.lowercaseFirstLetter(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.lowercaseFirstLetter(null));
     }
 
     @Test
@@ -864,14 +876,14 @@
         assertThat(StringUtils.lowercaseFirstLetter("Dings Bums"), is("dings Bums"));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testMidNegativeLen() {
-        StringUtils.mid(null, 0, -2);
+        assertThrows(IllegalArgumentException.class, () -> StringUtils.mid(null, 0, -2));
     }
 
-    @Test(expected = IndexOutOfBoundsException.class)
+    @Test
     public void testMidWrongPos() {
-        StringUtils.mid(null, -2, 3);
+        assertThrows(IndexOutOfBoundsException.class, () -> StringUtils.mid(null, -2, 3));
     }
 
     @Test
@@ -883,19 +895,19 @@
         assertThat(StringUtils.mid("dings bums", 3, 4), is("gs b"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testOverlayStringNPE1() {
-        StringUtils.overlayString(null, null, 0, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.overlayString(null, null, 0, 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testOverlayStringNPE2() {
-        StringUtils.overlayString("dings", null, 0, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.overlayString("dings", null, 0, 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testOverlayStringNPE3() {
-        StringUtils.overlayString(null, "bums", 0, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.overlayString(null, "bums", 0, 0));
     }
 
     @Test
@@ -905,19 +917,19 @@
         assertThat(StringUtils.overlayString("dings", "bums", 2, 4), is("dibumss"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testPrechompNPE1() {
-        StringUtils.prechomp(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.prechomp(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testPrechompNPE2() {
-        StringUtils.prechomp("dings", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.prechomp("dings", null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testPrechompNPE3() {
-        StringUtils.prechomp(null, "bums");
+        assertThrows(NullPointerException.class, () -> StringUtils.prechomp(null, "bums"));
     }
 
     @Test
@@ -1040,19 +1052,19 @@
                 is("\'a\\\"bc\'"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRemoveAndHumpNPE1() {
-        StringUtils.removeAndHump(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.removeAndHump(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRemoveAndHumpNPE2() {
-        StringUtils.removeAndHump("dings", null);
+        assertThrows(NullPointerException.class, () -> StringUtils.removeAndHump("dings", null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRemoveAndHumpNPE3() {
-        StringUtils.removeAndHump(null, "bums");
+        assertThrows(NullPointerException.class, () -> StringUtils.removeAndHump(null, "bums"));
     }
 
     @Test
@@ -1064,9 +1076,9 @@
         assertThat(StringUtils.removeAndHump("THIS-IS-IT", "-"), is("THISISIT"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRemoveDuplicateWhitespaceNPE() {
-        StringUtils.removeDuplicateWhitespace(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.removeDuplicateWhitespace(null));
     }
 
     @Test
@@ -1080,14 +1092,14 @@
         assertThat(StringUtils.removeDuplicateWhitespace("dings \t bums"), is("dings bums"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRepeatNPE() {
-        StringUtils.repeat(null, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.repeat(null, 0));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void testRepeatNegativeAmount() {
-        StringUtils.repeat("dings", -1);
+        assertThrows(NegativeArraySizeException.class, () -> StringUtils.repeat("dings", -1));
     }
 
     @Test
@@ -1182,14 +1194,14 @@
         assertThat(StringUtils.reverse("  dings "), is(" sgnid  "));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testReverseDelimitedStringNPE1() {
-        StringUtils.reverseDelimitedString(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.reverseDelimitedString(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testReverseDelimitedStringNPE2() {
-        StringUtils.reverseDelimitedString(null, " ");
+        assertThrows(NullPointerException.class, () -> StringUtils.reverseDelimitedString(null, " "));
     }
 
     @Test
@@ -1205,14 +1217,14 @@
         assertThat(StringUtils.reverseDelimitedString("dings bums", " "), is("bums dings"));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testRightIAE1() {
-        StringUtils.right(null, -1);
+        assertThrows(IllegalArgumentException.class, () -> StringUtils.right(null, -1));
     }
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testRightIAE2() {
-        StringUtils.right("dings", -1);
+        assertThrows(IllegalArgumentException.class, () -> StringUtils.right("dings", -1));
     }
 
     @Test
@@ -1226,9 +1238,9 @@
         assertThat(StringUtils.right("dings ", 3), is("gs "));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRightPad1NPE() {
-        StringUtils.rightPad(null, 0);
+        assertThrows(NullPointerException.class, () -> StringUtils.rightPad(null, 0));
     }
 
     @Test
@@ -1240,19 +1252,19 @@
         assertThat(StringUtils.rightPad("dings", 10), is("dings     "));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRightPad2NPE1() {
-        StringUtils.rightPad(null, 0, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.rightPad(null, 0, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRightPad2NPE2() {
-        StringUtils.rightPad("dings", 0, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.rightPad("dings", 0, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testRightPad2NPE23() {
-        StringUtils.rightPad(null, 0, "+");
+        assertThrows(NullPointerException.class, () -> StringUtils.rightPad(null, 0, "+"));
     }
 
     @Test
@@ -1264,9 +1276,9 @@
         assertThat(StringUtils.rightPad("dings", 10, "+"), is("dings+++++"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testSplit1NPE() {
-        StringUtils.split(null);
+        assertThrows(NullPointerException.class, () -> StringUtils.split(null));
     }
 
     @Test
@@ -1276,14 +1288,14 @@
         assertThat(StringUtils.split("dings bums"), is(new String[] {"dings", "bums"}));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testSplit2NPE1() {
-        StringUtils.split(null, null);
+        assertThrows(NullPointerException.class, () -> StringUtils.split(null, null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testSplit2NPE2() {
-        StringUtils.split(null, " ");
+        assertThrows(NullPointerException.class, () -> StringUtils.split(null, " "));
     }
 
     @Test
@@ -1297,14 +1309,14 @@
         assertThat(StringUtils.split("dings+bums", "+"), is(new String[] {"dings", "bums"}));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testSplit3NPE1() {
-        StringUtils.split(null, null, 1);
+        assertThrows(NullPointerException.class, () -> StringUtils.split(null, null, 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testSplit3NPE2() {
-        StringUtils.split(null, " ", 1);
+        assertThrows(NullPointerException.class, () -> StringUtils.split(null, " ", 1));
     }
 
     @Test
diff --git a/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java b/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java
index 171e8cb..1d79635 100644
--- a/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java
@@ -23,28 +23,43 @@
 import java.io.InputStream;
 import java.io.SequenceInputStream;
 
-import junit.framework.ComparisonFailure;
-import junit.framework.TestCase;
 import org.apache.commons.io.IOUtils;
 import org.apache.maven.shared.utils.xml.XmlStreamReader;
+import org.junit.jupiter.api.Test;
+import org.opentest4j.AssertionFailedError;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  *
  * @author <a href="mailto:hboutemy@apache.org">Hervé Boutemy</a>
  */
-public class XmlStreamReaderTest extends TestCase {
-    /** french */
+public class XmlStreamReaderTest {
+    /**
+     * french
+     */
     private static final String TEXT_LATIN1 = "eacute: \u00E9";
-    /** greek */
+    /**
+     * greek
+     */
     private static final String TEXT_LATIN7 = "alpha: \u03B1";
-    /** euro support */
+    /**
+     * euro support
+     */
     private static final String TEXT_LATIN15 = "euro: \u20AC";
-    /** japanese */
+    /**
+     * japanese
+     */
     private static final String TEXT_EUC_JP = "hiragana A: \u3042";
-    /** Unicode: support everything */
+    /**
+     * Unicode: support everything
+     */
     private static final String TEXT_UNICODE =
             TEXT_LATIN1 + ", " + TEXT_LATIN7 + ", " + TEXT_LATIN15 + ", " + TEXT_EUC_JP;
-    /** see http://unicode.org/faq/utf_bom.html#BOM */
+    /**
+     * see http://unicode.org/faq/utf_bom.html#BOM
+     */
     private static final byte[] BOM_UTF8 = {(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
 
     private static final byte[] BOM_UTF16BE = {(byte) 0xFE, (byte) 0xFF};
@@ -95,65 +110,78 @@
         checkXmlContent(xml, effectiveEncoding, bom);
     }
 
+    @Test
     public void testNoXmlHeader() throws IOException {
         String xml = "<text>text with no XML header</text>";
         checkXmlContent(xml, "UTF-8");
         checkXmlContent(xml, "UTF-8", BOM_UTF8);
     }
 
+    @Test
     public void testDefaultEncoding() throws IOException {
         checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8");
         checkXmlStreamReader(TEXT_UNICODE, null, "UTF-8", BOM_UTF8);
     }
 
+    @Test
     public void testUTF8Encoding() throws IOException {
         checkXmlStreamReader(TEXT_UNICODE, "UTF-8");
         checkXmlStreamReader(TEXT_UNICODE, "UTF-8", BOM_UTF8);
     }
 
+    @Test
     public void testUTF16Encoding() throws IOException {
         checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", null);
         checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16LE", BOM_UTF16LE);
         checkXmlStreamReader(TEXT_UNICODE, "UTF-16", "UTF-16BE", BOM_UTF16BE);
     }
 
+    @Test
     public void testUTF16BEEncoding() throws IOException {
         checkXmlStreamReader(TEXT_UNICODE, "UTF-16BE");
     }
 
+    @Test
     public void testUTF16LEEncoding() throws IOException {
         checkXmlStreamReader(TEXT_UNICODE, "UTF-16LE");
     }
 
+    @Test
     public void testLatin1Encoding() throws IOException {
         checkXmlStreamReader(TEXT_LATIN1, "ISO-8859-1");
     }
 
+    @Test
     public void testLatin7Encoding() throws IOException {
         checkXmlStreamReader(TEXT_LATIN7, "ISO-8859-7");
     }
 
+    @Test
     public void testLatin15Encoding() throws IOException {
         checkXmlStreamReader(TEXT_LATIN15, "ISO-8859-15");
     }
 
+    @Test
     public void testEUCJPEncoding() throws IOException {
         checkXmlStreamReader(TEXT_EUC_JP, "EUC-JP");
     }
 
+    @Test
     public void testEBCDICEncoding() throws IOException {
         checkXmlStreamReader("simple text in EBCDIC", "CP1047");
     }
 
+    @Test
     public void testInappropriateEncoding() throws IOException {
         try {
             checkXmlStreamReader(TEXT_UNICODE, "ISO-8859-2");
             fail("Check should have failed, since some characters are not available in the specified encoding");
-        } catch (ComparisonFailure cf) {
+        } catch (AssertionFailedError cf) {
             // expected failure, since the encoding does not contain some characters
         }
     }
 
+    @Test
     public void testEncodingAttribute() throws IOException {
         String xml = "<?xml version='1.0' encoding='US-ASCII'?><element encoding='attribute value'/>";
         checkXmlContent(xml, "US-ASCII");
diff --git a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
index 19fbc92..5d02bb8 100644
--- a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java
@@ -25,15 +25,15 @@
 import java.util.Properties;
 
 import org.apache.maven.shared.utils.Os;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.hasItemInArray;
 import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class CommandLineUtilsTest {
 
diff --git a/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java b/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java
index 47a8b1d..3b6652d 100644
--- a/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java
@@ -22,10 +22,10 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 public class StreamPollFeederTest {
 
diff --git a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
index f05108b..d5282d8 100644
--- a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
@@ -20,16 +20,20 @@
 
 import java.util.List;
 
-import junit.framework.TestCase;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.cli.Commandline;
+import org.junit.jupiter.api.Test;
 
-public class BourneShellTest extends TestCase {
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class BourneShellTest {
 
     Shell newShell() {
         return new BourneShell();
     }
 
+    @Test
     public void testQuoteWorkingDirectoryAndExecutable() {
         Shell sh = newShell();
 
@@ -41,6 +45,7 @@
         assertEquals("/bin/sh -c cd '/usr/local/bin' && 'chmod'", executable);
     }
 
+    @Test
     public void testQuoteWorkingDirectoryAndExecutableWDPathWithSingleQuotes() {
         Shell sh = newShell();
 
@@ -52,6 +57,7 @@
         assertEquals("/bin/sh -c cd '/usr/local/'\"'\"'something else'\"'\"'' && 'chmod'", executable);
     }
 
+    @Test
     public void testQuoteWorkingDirectoryAndExecutableWDPathWithSingleQuotesBackslashFileSep() {
         Shell sh = newShell();
 
@@ -63,6 +69,7 @@
         assertEquals("/bin/sh -c cd '\\usr\\local\\'\"'\"'something else'\"'\"'' && 'chmod'", executable);
     }
 
+    @Test
     public void testPreserveSingleQuotesOnArgument() {
         Shell sh = newShell();
 
@@ -75,6 +82,7 @@
         assertTrue(cli.endsWith("'\"some arg with spaces\"'"));
     }
 
+    @Test
     public void testAddSingleQuotesOnArgumentWithSpaces() {
         Shell sh = newShell();
 
@@ -87,6 +95,7 @@
         assertTrue(cli.endsWith("'some arg with spaces'"));
     }
 
+    @Test
     public void testAddArgumentWithSingleQuote() {
         Shell sh = newShell();
 
@@ -99,6 +108,7 @@
                 "cd '/usr/bin' && 'chmod' 'arg'\"'\"'withquote'", shellCommandLine.get(shellCommandLine.size() - 1));
     }
 
+    @Test
     public void testArgumentsWithSemicolon() {
         Shell sh = newShell();
 
@@ -145,6 +155,7 @@
         assertEquals("\"--password ;password\"", lines.get(3));
     }
 
+    @Test
     public void testBourneShellQuotingCharacters() throws Exception {
         // { ' ', '$', ';', '&', '|', '<', '>', '*', '?', '(', ')' };
         // test with values https://steve-parker.org/sh/bourne.shtml Appendix B - Meta-characters and Reserved Words
diff --git a/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java b/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
index b340370..9160e79 100644
--- a/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractorTest.java
@@ -23,17 +23,22 @@
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.TestCase;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
  *
  */
-public class ReflectionValueExtractorTest extends TestCase {
+public class ReflectionValueExtractorTest {
     private Project project;
 
-    protected void setUp() throws Exception {
-        super.setUp();
+    @BeforeEach
+    public void setUp() throws Exception {
 
         Dependency dependency1 = new Dependency();
         dependency1.setArtifactId("dep1");
@@ -58,6 +63,7 @@
         project.addArtifact(new Artifact("g2", "a2", "v2", "e2", "c2"));
     }
 
+    @Test
     public void testValueExtraction() throws IntrospectionException {
         // ----------------------------------------------------------------------
         // Top level values
@@ -137,12 +143,14 @@
         assertNotNull(build);
     }
 
+    @Test
     public void testValueExtractorWithAInvalidExpression() throws IntrospectionException {
         assertNull(ReflectionValueExtractor.evaluate("project.foo", project));
         assertNull(ReflectionValueExtractor.evaluate("project.dependencies[10]", project));
         assertNull(ReflectionValueExtractor.evaluate("project.dependencies[0].foo", project));
     }
 
+    @Test
     public void testMappedDottedKey() throws IntrospectionException {
         Map<String, String> map = new HashMap<>();
         map.put("a.b", "a.b-value");
@@ -150,6 +158,7 @@
         assertEquals("a.b-value", ReflectionValueExtractor.evaluate("h.value(a.b)", new ValueHolder(map)));
     }
 
+    @Test
     public void testIndexedMapped() throws IntrospectionException {
         Map<Object, Object> map = new HashMap<>();
         map.put("a", "a-value");
@@ -159,6 +168,7 @@
         assertEquals("a-value", ReflectionValueExtractor.evaluate("h.value[0](a)", new ValueHolder(list)));
     }
 
+    @Test
     public void testMappedIndexed() throws IntrospectionException {
         List<Object> list = new ArrayList<>();
         list.add("a-value");
@@ -167,22 +177,26 @@
         assertEquals("a-value", ReflectionValueExtractor.evaluate("h.value(a)[0]", new ValueHolder(map)));
     }
 
+    @Test
     public void testMappedMissingDot() throws IntrospectionException {
         Map<Object, Object> map = new HashMap<>();
         map.put("a", new ValueHolder("a-value"));
         assertNull(ReflectionValueExtractor.evaluate("h.value(a)value", new ValueHolder(map)));
     }
 
+    @Test
     public void testIndexedMissingDot() throws IntrospectionException {
         List<Object> list = new ArrayList<>();
         list.add(new ValueHolder("a-value"));
         assertNull(ReflectionValueExtractor.evaluate("h.value[0]value", new ValueHolder(list)));
     }
 
+    @Test
     public void testDotDot() throws IntrospectionException {
         assertNull(ReflectionValueExtractor.evaluate("h..value", new ValueHolder("value")));
     }
 
+    @Test
     public void testBadIndexedSyntax() throws IntrospectionException {
         List<Object> list = new ArrayList<>();
         list.add("a-value");
@@ -196,6 +210,7 @@
         assertNull(ReflectionValueExtractor.evaluate("h.value[-1]", value));
     }
 
+    @Test
     public void testBadMappedSyntax() throws IntrospectionException {
         Map<Object, Object> map = new HashMap<>();
         map.put("a", "a-value");
@@ -207,6 +222,7 @@
         assertNull(ReflectionValueExtractor.evaluate("h.value(a]", value));
     }
 
+    @Test
     public void testIllegalIndexedType() {
         try {
             ReflectionValueExtractor.evaluate("h.value[1]", new ValueHolder("string"));
@@ -215,6 +231,7 @@
         }
     }
 
+    @Test
     public void testIllegalMappedType() {
         try {
             ReflectionValueExtractor.evaluate("h.value(key)", new ValueHolder("string"));
@@ -223,10 +240,12 @@
         }
     }
 
+    @Test
     public void testTrimRootToken() throws IntrospectionException {
         assertNull(ReflectionValueExtractor.evaluate("project", project, true));
     }
 
+    @Test
     public void testArtifactMap() throws IntrospectionException {
         assertEquals(
                 "g0",
@@ -451,6 +470,7 @@
         }
     }
 
+    @Test
     public void testRootPropertyRegression() throws IntrospectionException {
         Project project = new Project();
         project.setDescription("c:\\\\org\\apache\\test");
diff --git a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
index f600d61..9ab2a5c 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/DirectoryScannerTest.java
@@ -26,29 +26,30 @@
 
 import org.apache.maven.shared.utils.Os;
 import org.apache.maven.shared.utils.testhelpers.FileTestHelper;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
 
 @SuppressWarnings("deprecation")
 public class DirectoryScannerTest {
     private static final String[] NONE = new String[0];
 
-    @Rule
-    public TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir
+    private File tempFolder;
 
     private void createTestData() throws IOException {
-        File rootDir = tempFolder.getRoot();
+        File rootDir = tempFolder;
         File folder1 = new File(rootDir, "folder1");
         if (!folder1.mkdirs()) {
-            Assert.fail();
+            Assertions.fail();
         }
 
         FileTestHelper.generateTestFile(new File(rootDir, "file1.txt"), 11);
@@ -60,7 +61,7 @@
 
         File folder2 = new File(folder1, "ignorefolder");
         if (!folder2.mkdirs()) {
-            Assert.fail();
+            Assertions.fail();
         }
         FileTestHelper.generateTestFile(new File(folder2, "file7.txt"), 17);
     }
@@ -131,9 +132,6 @@
                 /* expExclDirs     */ NONE);
     }
 
-    @Rule
-    public ExpectedException xcludesNPExRule = ExpectedException.none();
-
     @Test
     public void testIncludesWithNull() throws Exception {
         testXcludesWithNull(new String[] {null}, null, "includes");
@@ -144,23 +142,25 @@
         testXcludesWithNull(null, new String[] {null}, "excludes");
     }
 
-    private void testXcludesWithNull(String[] includes, String[] excludes, String listName) throws Exception {
+    private void testXcludesWithNull(String[] includes, String[] excludes, String listName) throws IOException {
         createTestData();
-        xcludesNPExRule.expect(NullPointerException.class);
-        xcludesNPExRule.expectMessage("If a non-null " + listName + " list is given, all elements must be non-null");
-
-        fitScanTest(
-                true,
-                true,
-                true,
-                /* includes        */ includes,
-                /* excludes        */ excludes,
-                /* expInclFiles    */ new String[] {"file3.dat", "folder1/file5.dat"},
-                /* expInclDirs     */ NONE,
-                /* expNotInclFiles */ new String[] {"file1.txt", "file2.txt", "folder1/file4.txt"},
-                /* expNotInclDirs  */ new String[] {"", "folder1"},
-                /* expExclFiles    */ NONE,
-                /* expExclDirs     */ NONE);
+        Throwable exception = assertThrows(
+                NullPointerException.class,
+                () -> fitScanTest(
+                        true,
+                        true,
+                        true,
+                        /* includes        */ includes,
+                        /* excludes        */ excludes,
+                        /* expInclFiles    */ new String[] {"file3.dat", "folder1/file5.dat"},
+                        /* expInclDirs     */ NONE,
+                        /* expNotInclFiles */ new String[] {"file1.txt", "file2.txt", "folder1/file4.txt"},
+                        /* expNotInclDirs  */ new String[] {"", "folder1"},
+                        /* expExclFiles    */ NONE,
+                        /* expExclDirs     */ NONE));
+        assertThat(
+                exception.getMessage(),
+                containsString("If a non-null " + listName + " list is given, all elements must be non-null"));
     }
 
     @Test
@@ -179,7 +179,7 @@
         assertAlwaysIncluded(Arrays.asList(files));
 
         // FIXME getIncludedFiles is broken on Windows; correct answer is 9
-        assertTrue("files.length is " + files.length, files.length == 9 || files.length == 11);
+        assertTrue(files.length == 9 || files.length == 11, "files.length is " + files.length);
     }
 
     @Test
@@ -292,7 +292,7 @@
             String[] expectedExcludedFiles,
             String[] expectedExcludedDirectories) {
         DirectoryScanner ds = new DirectoryScanner();
-        ds.setBasedir(tempFolder.getRoot());
+        ds.setBasedir(tempFolder);
 
         ds.setCaseSensitive(caseSensitive);
         ds.setFollowSymlinks(followSymLinks);
@@ -336,14 +336,14 @@
         if (expectedFiles != null) {
             String msg = category + " expected: " + Arrays.toString(expectedFiles) + " but got: "
                     + Arrays.toString(resolvedFiles);
-            Assert.assertNotNull(msg, resolvedFiles);
-            assertEquals(msg, expectedFiles.length, resolvedFiles.length);
+            Assertions.assertNotNull(resolvedFiles, msg);
+            assertEquals(expectedFiles.length, resolvedFiles.length, msg);
 
             Arrays.sort(expectedFiles);
             Arrays.sort(resolvedFiles);
 
             for (int i = 0; i < resolvedFiles.length; i++) {
-                assertEquals(msg, expectedFiles[i], resolvedFiles[i].replace("\\", "/"));
+                assertEquals(expectedFiles[i], resolvedFiles[i].replace("\\", "/"), msg);
             }
         }
     }
@@ -369,7 +369,7 @@
     }
 
     private void removeAndAddSomeFiles() throws IOException {
-        File rootDir = tempFolder.getRoot();
+        File rootDir = tempFolder;
         File file2 = new File(rootDir, "file2.txt");
         file2.delete();
 
@@ -384,8 +384,8 @@
         createTestData();
 
         DirectoryScanner dss = new DirectoryScanner();
-        dss.setBasedir(tempFolder.getRoot());
-        Assert.assertNotNull(dss);
+        dss.setBasedir(tempFolder);
+        Assertions.assertNotNull(dss);
 
         // we take the initial snapshot
         dss.scan();
@@ -400,17 +400,17 @@
 
         String[] addedFiles = dsr.getFilesAdded();
         String[] removedFiles = dsr.getFilesRemoved();
-        Assert.assertNotNull(addedFiles);
-        Assert.assertNotNull(removedFiles);
+        Assertions.assertNotNull(addedFiles);
+        Assertions.assertNotNull(removedFiles);
         assertEquals(1, addedFiles.length);
         assertEquals(2, removedFiles.length);
     }
 
-    @Ignore("Enable this test to run performance checks")
+    @Disabled("Enable this test to run performance checks")
     @Test
     public void performanceTest() throws Exception {
 
-        File rootFolder = tempFolder.getRoot();
+        File rootFolder = tempFolder;
 
         // do some warmup
         for (int i = 1; i < 200; i++) {
@@ -447,7 +447,7 @@
             directoryScanner.scan();
 
             DirectoryScanResult directoryScanResult = directoryScanner.diffIncludedFiles(oldFiles);
-            Assert.assertNotNull(directoryScanResult);
+            Assertions.assertNotNull(directoryScanResult);
 
             FileUtils.deleteDirectory(rootFolder);
             rootFolder.mkdir();
diff --git a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
index c78c3a7..52eb9b6 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java
@@ -33,36 +33,35 @@
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.Writer;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.maven.shared.utils.Os;
 import org.apache.maven.shared.utils.testhelpers.FileTestHelper;
-import org.hamcrest.CoreMatchers;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+import org.junit.jupiter.api.io.TempDir;
 
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.hasItems;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeThat;
+import static org.junit.jupiter.api.Assertions.assertAll;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertIterableEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 /**
  * This is used to test FileUtils for correctness.
@@ -79,11 +78,10 @@
 
     // Test data
 
-    @Rule
-    public TemporaryFolder tempFolder = new TemporaryFolder();
+    @TempDir
+    private File tempFolder;
 
-    @Rule
-    public TestName name = new TestName();
+    private String name;
 
     /**
      * Size of test directory.
@@ -99,21 +97,25 @@
     private long testFile2Size;
 
     /**
-     * @see junit.framework.TestCase#setUp()
+     * @see
      */
-    @Before
-    public void setUp() throws Exception {
-        testFile1 = tempFolder.newFile("file1-test.txt");
-        testFile2 = tempFolder.newFile("file1a-test.txt");
+    @BeforeEach
+    public void setUp(TestInfo testInfo) throws Exception {
+        Optional<Method> testMethod = testInfo.getTestMethod();
+        if (testMethod.isPresent()) {
+            this.name = testMethod.get().getName();
+        }
+        testFile1 = newFile(tempFolder, "file1-test.txt");
+        testFile2 = newFile(tempFolder, "file1a-test.txt");
 
         testFile1Size = (int) testFile1.length();
         testFile2Size = (int) testFile2.length();
 
-        tempFolder.getRoot().mkdirs();
+        tempFolder.mkdirs();
         createFile(testFile1, testFile1Size);
         createFile(testFile2, testFile2Size);
-        FileUtils.deleteDirectory(tempFolder.getRoot());
-        tempFolder.getRoot().mkdirs();
+        FileUtils.deleteDirectory(tempFolder);
+        tempFolder.mkdirs();
         createFile(testFile1, testFile1Size);
         createFile(testFile2, testFile2Size);
     }
@@ -139,16 +141,16 @@
                 numRead = is.read(b1, count, b0.length);
                 count += numRead;
             }
-            assertThat("Different number of bytes: ", count, is(b0.length));
+            assertEquals(b0.length, count, "Different number of bytes: ");
             for (int i = 0; i < count; i++) {
-                assertEquals("byte " + i + " differs", b1[i], b0[i]);
+                assertEquals(b0[i], b1[i], "byte " + i + " differs");
             }
         }
     }
 
     private void deleteFile(File file) {
         if (file.exists()) {
-            assertTrue("Couldn't delete file: " + file, file.delete());
+            assertTrue(file.delete(), "Couldn't delete file: " + file);
         }
     }
 
@@ -157,27 +159,29 @@
     public void toFile1() throws Exception {
         URL url = new URL("file", null, "a/b/c/file.txt");
         File file = FileUtils.toFile(url);
-        assertThat(file.toString(), containsString("file.txt"));
+        assertTrue(file.toString().contains("file.txt"));
     }
 
     @Test
     public void toFile2() throws Exception {
         URL url = new URL("file", null, "a/b/c/file%20n%61me%2520.tx%74");
         File file = FileUtils.toFile(url);
-        assertThat(file.toString(), containsString("file name%20.txt"));
+        assertTrue(file.toString().contains("file name%20.txt"));
     }
 
     @Test
     public void toFile3() throws Exception {
-        assertThat(FileUtils.toFile(null), CoreMatchers.nullValue());
-        assertThat(FileUtils.toFile(new URL("http://jakarta.apache.org")), CoreMatchers.nullValue());
+        assertNull(FileUtils.toFile(null));
+        assertNull(FileUtils.toFile(new URL("http://jakarta.apache.org")));
     }
 
-    @Test(expected = NumberFormatException.class)
+    @Test
     public void toFile4() throws Exception {
-        URL url = new URL("file", null, "a/b/c/file%%20%me.txt%");
-        File file = FileUtils.toFile(url);
-        assertThat(file.toString(), containsString("file% %me.txt%"));
+        assertThrows(NumberFormatException.class, () -> {
+            URL url = new URL("file", null, "a/b/c/file%%20%me.txt%");
+            File file = FileUtils.toFile(url);
+            assertTrue(file.toString().contains("file% %me.txt%"));
+        });
     }
 
     /**
@@ -187,14 +191,14 @@
     public void toFile5() throws Exception {
         URL url = new URL("file", null, "both%20are%20100%20%25%20true");
         File file = FileUtils.toFile(url);
-        assertThat(file.toString(), is("both are 100 % true"));
+        assertEquals("both are 100 % true", file.toString());
     }
 
     @Test
     public void toFileUtf8() throws Exception {
         URL url = new URL("file", null, "/home/%C3%A4%C3%B6%C3%BC%C3%9F");
         File file = FileUtils.toFile(url);
-        assertThat(file.toString(), not(containsString("\u00E4\u00F6\u00FC\u00DF")));
+        assertFalse(file.toString().contains("\u00E4\u00F6\u00FC\u00DF"));
     }
 
     // toURLs
@@ -202,21 +206,19 @@
     @Test
     public void toURLs1() throws Exception {
         File[] files = new File[] {
-            new File(tempFolder.getRoot(), "file1.txt"),
-            new File(tempFolder.getRoot(), "file2.txt"),
-            new File(tempFolder.getRoot(), "test file.txt"),
+            new File(tempFolder, "file1.txt"), new File(tempFolder, "file2.txt"), new File(tempFolder, "test file.txt"),
         };
         URL[] urls = FileUtils.toURLs(files);
 
-        assertThat(urls.length, is(files.length));
-        assertThat(urls[0].toExternalForm().startsWith("file:"), is(true));
-        assertThat(urls[0].toExternalForm().contains("file1.txt"), is(true));
-        assertThat(urls[1].toExternalForm().startsWith("file:"), is(true));
-        assertThat(urls[1].toExternalForm(), containsString("file2.txt"));
+        assertEquals(files.length, urls.length);
+        assertTrue(urls[0].toExternalForm().startsWith("file:"));
+        assertTrue(urls[0].toExternalForm().contains("file1.txt"));
+        assertTrue(urls[1].toExternalForm().startsWith("file:"));
+        assertTrue(urls[1].toExternalForm().contains("file2.txt"));
 
         // Test escaped char
-        assertThat(urls[2].toExternalForm().startsWith("file:"), is(true));
-        assertThat(urls[2].toExternalForm(), containsString("test%20file.txt"));
+        assertTrue(urls[2].toExternalForm().startsWith("file:"));
+        assertTrue(urls[2].toExternalForm().contains("test%20file.txt"));
     }
 
     // contentEquals
@@ -224,43 +226,43 @@
     @Test
     public void contentEquals() throws Exception {
         // Non-existent files
-        File file = new File(tempFolder.getRoot(), name.getMethodName());
-        File file2 = new File(tempFolder.getRoot(), name.getMethodName() + "2");
+        File file = new File(tempFolder, name);
+        File file2 = new File(tempFolder, name + "2");
         // both don't  exist
-        assertThat(FileUtils.contentEquals(file, file), is(true));
-        assertThat(FileUtils.contentEquals(file, file2), is(true));
-        assertThat(FileUtils.contentEquals(file2, file2), is(true));
-        assertThat(FileUtils.contentEquals(file2, file), is(true));
+        assertTrue(FileUtils.contentEquals(file, file));
+        assertTrue(FileUtils.contentEquals(file, file2));
+        assertTrue(FileUtils.contentEquals(file2, file2));
+        assertTrue(FileUtils.contentEquals(file2, file));
 
         // Directories
-        FileUtils.contentEquals(tempFolder.getRoot(), tempFolder.getRoot());
+        FileUtils.contentEquals(tempFolder, tempFolder);
 
         // Different files
-        File objFile1 = new File(tempFolder.getRoot(), name.getMethodName() + ".object");
+        File objFile1 = new File(tempFolder, name + ".object");
         objFile1.deleteOnExit();
         FileUtils.copyURLToFile(getClass().getResource("/java/lang/Object.class"), objFile1);
 
-        File objFile1b = new File(tempFolder.getRoot(), name.getMethodName() + ".object2");
+        File objFile1b = new File(tempFolder, name + ".object2");
         objFile1.deleteOnExit();
         FileUtils.copyURLToFile(getClass().getResource("/java/lang/Object.class"), objFile1b);
 
-        File objFile2 = new File(tempFolder.getRoot(), name.getMethodName() + ".collection");
+        File objFile2 = new File(tempFolder, name + ".collection");
         objFile2.deleteOnExit();
         FileUtils.copyURLToFile(getClass().getResource("/java/util/Collection.class"), objFile2);
 
-        assertThat(FileUtils.contentEquals(objFile1, objFile2), is(false));
-        assertThat(FileUtils.contentEquals(objFile1b, objFile2), is(false));
-        assertThat(FileUtils.contentEquals(objFile1, objFile1b), is(true));
+        assertFalse(FileUtils.contentEquals(objFile1, objFile2));
+        assertFalse(FileUtils.contentEquals(objFile1b, objFile2));
+        assertTrue(FileUtils.contentEquals(objFile1, objFile1b));
 
-        assertThat(FileUtils.contentEquals(objFile1, objFile1), is(true));
-        assertThat(FileUtils.contentEquals(objFile1b, objFile1b), is(true));
-        assertThat(FileUtils.contentEquals(objFile2, objFile2), is(true));
+        assertTrue(FileUtils.contentEquals(objFile1, objFile1));
+        assertTrue(FileUtils.contentEquals(objFile1b, objFile1b));
+        assertTrue(FileUtils.contentEquals(objFile2, objFile2));
 
         // Equal files
         file.createNewFile();
         file2.createNewFile();
-        assertThat(FileUtils.contentEquals(file, file), is(true));
-        assertThat(FileUtils.contentEquals(file, file2), is(true));
+        assertTrue(FileUtils.contentEquals(file, file));
+        assertTrue(FileUtils.contentEquals(file, file2));
     }
 
     // copyURLToFile
@@ -268,7 +270,7 @@
     @Test
     public void copyURLToFile() throws Exception {
         // Creates file
-        File file = new File(tempFolder.getRoot(), name.getMethodName());
+        File file = new File(tempFolder, name);
         file.deleteOnExit();
 
         // Loads resource
@@ -277,10 +279,8 @@
 
         // Tests that resource was copied correctly
         try (FileInputStream fis = new FileInputStream(file)) {
-            assertThat(
-                    "Content is not equal.",
-                    IOUtil.contentEquals(getClass().getResourceAsStream(resourceName), fis),
-                    is(true));
+            assertTrue(
+                    IOUtil.contentEquals(getClass().getResourceAsStream(resourceName), fis), "Content is not equal.");
         }
         // TODO Maybe test copy to itself like for copyFile()
     }
@@ -290,13 +290,13 @@
     @Test
     public void forceMkdir() throws Exception {
         // Tests with existing directory
-        FileUtils.forceMkdir(tempFolder.getRoot());
+        FileUtils.forceMkdir(tempFolder);
 
         // Creates test file
-        File testFile = new File(tempFolder.getRoot(), name.getMethodName());
+        File testFile = new File(tempFolder, name);
         testFile.deleteOnExit();
         testFile.createNewFile();
-        assertThat("Test file does not exist.", testFile.exists(), is(true));
+        assertTrue(testFile.exists(), "Test file does not exist.");
 
         // Tests with existing file
         try {
@@ -309,14 +309,14 @@
 
         // Tests with non-existent directory
         FileUtils.forceMkdir(testFile);
-        assertThat("Directory was not created.", testFile.exists(), is(true));
+        assertTrue(testFile.exists(), "Directory was not created.");
     }
 
     // sizeOfDirectory
 
     @Test
     public void sizeOfDirectory() throws Exception {
-        File file = new File(tempFolder.getRoot(), name.getMethodName());
+        File file = new File(tempFolder, name);
 
         // Non-existent file
         try {
@@ -340,22 +340,22 @@
         file.delete();
         file.mkdir();
 
-        assertThat("Unexpected directory size", FileUtils.sizeOfDirectory(file), is((long) TEST_DIRECTORY_SIZE));
+        assertEquals((long) TEST_DIRECTORY_SIZE, FileUtils.sizeOfDirectory(file), "Unexpected directory size");
     }
 
     // copyFile
 
     @Test
     public void copyFile1() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy1.txt");
+        File destination = new File(tempFolder, "copy1.txt");
 
         // Thread.sleep(LAST_MODIFIED_DELAY);
         // This is to slow things down so we can catch if
         // the lastModified date is not ok
 
         FileUtils.copyFile(testFile1, destination);
-        assertThat("Check Exist", destination.exists(), is(true));
-        assertThat("Check Full copy", destination.length(), is(testFile1Size));
+        assertTrue(destination.exists(), "Check Exist");
+        assertEquals(testFile1Size, destination.length(), "Check Full copy");
         /* disabled: Thread.sleep doesn't work reliantly for this case
         assertTrue("Check last modified date preserved",
             testFile1.lastModified() == destination.lastModified());*/
@@ -374,23 +374,23 @@
     @Test
     public void copyFileWithNoFiltersAndNoDestination() throws Exception {
         File from = write("from.txt", MODIFIED_YESTERDAY, "Hello World!");
-        File to = new File(tempFolder.getRoot(), "to.txt");
+        File to = new File(tempFolder, "to.txt");
 
         FileUtils.copyFile(from, to, null, (FileUtils.FilterWrapper[]) null);
 
-        assertTrue("to.txt did not exist so should have been written", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt did not exist so should have been written");
         assertFileContent(to, "Hello World!");
     }
 
     @Test
     public void copyFileWithNoFiltersAndLastModifiedDateOfZeroAndNoDestination() throws Exception {
         File from = write("from.txt", MODIFIED_YESTERDAY, "Hello World!");
-        File to = new File(tempFolder.getRoot(), "to.txt");
+        File to = new File(tempFolder, "to.txt");
 
         from.setLastModified(0);
         FileUtils.copyFile(from, to, null, (FileUtils.FilterWrapper[]) null);
 
-        assertTrue("to.txt did not exist so should have been written", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt did not exist so should have been written");
         assertFileContent(to, "Hello World!");
     }
 
@@ -401,7 +401,7 @@
 
         FileUtils.copyFile(from, to, null, (FileUtils.FilterWrapper[]) null);
 
-        assertTrue("to.txt was outdated so should have been overwritten", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was outdated so should have been overwritten");
         assertFileContent(to, "Hello World!");
     }
 
@@ -412,7 +412,7 @@
 
         FileUtils.copyFile(from, to, null, (FileUtils.FilterWrapper[]) null);
 
-        assertTrue("to.txt was newer so should have been left alone", to.lastModified() < MODIFIED_TODAY);
+        assertTrue(to.lastModified() < MODIFIED_TODAY, "to.txt was newer so should have been left alone");
         assertFileContent(to, "Older content");
     }
 
@@ -423,7 +423,7 @@
 
         FileUtils.copyFile(from, to, null, null, true);
 
-        assertTrue("to.txt was newer but the overwrite should have been forced", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was newer but the overwrite should have been forced");
         assertFileContent(to, "Hello World!");
     }
 
@@ -434,18 +434,18 @@
 
         FileUtils.copyFile(from, to, null);
 
-        assertTrue("to.txt was outdated so should have been overwritten", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was outdated so should have been overwritten");
         assertFileContent(to, "Hello ${name}!");
     }
 
     @Test
     public void copyFileWithFilteringAndNoDestination() throws Exception {
         File from = write("from.txt", MODIFIED_YESTERDAY, "Hello ${name}!");
-        File to = new File(tempFolder.getRoot(), "to.txt");
+        File to = new File(tempFolder, "to.txt");
 
         FileUtils.copyFile(from, to, null, wrappers());
 
-        assertTrue("to.txt did not exist so should have been written", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt did not exist so should have been written");
         assertFileContent(to, "Hello Bob!");
     }
 
@@ -456,7 +456,7 @@
 
         FileUtils.copyFile(from, to, null, wrappers());
 
-        assertTrue("to.txt was outdated so should have been overwritten", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was outdated so should have been overwritten");
         assertFileContent(to, "Hello Bob!");
     }
 
@@ -467,7 +467,7 @@
 
         FileUtils.copyFile(from, to, null, wrappers(), true);
 
-        assertTrue("to.txt was newer but the overwrite should have been forced", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was newer but the overwrite should have been forced");
         assertFileContent(to, "Hello Bob!");
     }
 
@@ -478,7 +478,7 @@
 
         FileUtils.copyFile(from, to, null, wrappers());
 
-        assertTrue("to.txt was outdated so should have been overwritten", to.lastModified() >= MODIFIED_TODAY);
+        assertTrue(to.lastModified() >= MODIFIED_TODAY, "to.txt was outdated so should have been overwritten");
         assertFileContent(to, "Hello Bob!");
     }
 
@@ -490,7 +490,7 @@
         FileUtils.copyFile(from, to, null, wrappers());
 
         assertFileContent(to, "Hello Bob!");
-        assertTrue("to.txt content should be unchanged and have been left alone", to.lastModified() < MODIFIED_TODAY);
+        assertTrue(to.lastModified() < MODIFIED_TODAY, "to.txt content should be unchanged and have been left alone");
     }
 
     private static FileUtils.FilterWrapper[] wrappers() {
@@ -505,18 +505,18 @@
     }
 
     private File write(@Nonnull String name, long lastModified, @Nonnull String text) throws IOException {
-        final File file = new File(tempFolder.getRoot(), name);
+        final File file = new File(tempFolder, name);
         try (Writer writer = new FileWriter(file)) {
             writer.write(text);
         }
         assertTrue(file.setLastModified(lastModified));
-        assertEquals("Failed to set lastModified date on " + file.getPath(), lastModified, file.lastModified());
+        assertEquals(lastModified, file.lastModified(), "Failed to set lastModified date on " + file.getPath());
         return file;
     }
 
     private static void assertFileContent(@Nonnull File file, @Nonnull String expected) throws IOException {
         try (Reader in = new FileReader(file)) {
-            assertEquals("Expected " + file.getPath() + " to contain: " + expected, expected, IOUtils.toString(in));
+            assertEquals(expected, IOUtils.toString(in), "Expected " + file.getPath() + " to contain: " + expected);
         }
     }
 
@@ -524,7 +524,7 @@
     public void copyFileThatIsSymlink() throws Exception {
         assumeFalse(Os.isFamily(Os.FAMILY_WINDOWS));
 
-        File destination = new File(tempFolder.getRoot(), "symCopy.txt");
+        File destination = new File(tempFolder, "symCopy.txt");
 
         File testDir = SymlinkTestSetup.createStandardSymlinkTestDir(new File("target/test/symlinkCopy"));
 
@@ -535,21 +535,23 @@
 
     @Test
     public void deleteFile() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy1.txt");
+        File destination = new File(tempFolder, "copy1.txt");
         FileUtils.copyFile(testFile1, destination);
         FileUtils.delete(destination);
-        assertThat("Check Exist", destination.exists(), is(false));
+        assertFalse(destination.exists(), "Check Exist");
     }
 
-    @Test(expected = IOException.class)
+    @Test
     public void deleteFileNofile() throws Exception {
-        File destination = new File("abc/cde");
-        FileUtils.delete(destination);
+        assertThrows(IOException.class, () -> {
+            File destination = new File("abc/cde");
+            FileUtils.delete(destination);
+        });
     }
 
     @Test
     public void deleteFileLegacy() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy1.txt");
+        File destination = new File(tempFolder, "copy1.txt");
         FileUtils.copyFile(testFile1, destination);
         assertTrue(FileUtils.deleteLegacyStyle(destination));
     }
@@ -564,33 +566,32 @@
     public void copyFileWithPermissions() throws Exception {
         File source = new File("src/test/resources/executable");
         source.setExecutable(true);
-        assumeThat("Need an existing file to copy", source.exists(), is(true));
-        assumeThat("Need an executable file to copy", source.canExecute(), is(true));
+        assumeTrue(source.exists(), "Need an existing file to copy");
+        assumeTrue(source.canExecute(), "Need an executable file to copy");
 
-        File destination = new File(tempFolder.getRoot(), "executable-copy");
+        File destination = new File(tempFolder, "executable-copy");
 
         FileUtils.copyFile(source, destination);
 
-        assertThat(
-                "destination not exists: " + destination.getAbsolutePath() + ", directory content: "
-                        + Arrays.asList(destination.getParentFile().list()),
+        assertTrue(
                 Files.exists(destination.toPath()),
-                is(true));
+                "destination not exists: " + destination.getAbsolutePath() + ", directory content: "
+                        + Arrays.asList(destination.getParentFile().list()));
 
-        assertThat("Check copy executable", destination.canExecute(), is(true));
+        assertTrue(destination.canExecute(), "Check copy executable");
     }
 
     @Test
     public void copyFile2() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy2.txt");
+        File destination = new File(tempFolder, "copy2.txt");
 
         // Thread.sleep(LAST_MODIFIED_DELAY);
         // This is to slow things down so we can catch if
         // the lastModified date is not ok
 
         FileUtils.copyFile(testFile1, destination);
-        assertThat("Check Exist", destination.exists(), is(true));
-        assertThat("Check Full copy", destination.length(), is(testFile2Size));
+        assertTrue(destination.exists(), "Check Exist");
+        assertEquals(testFile2Size, destination.length(), "Check Full copy");
         /* disabled: Thread.sleep doesn't work reliably for this case
         assertTrue("Check last modified date preserved",
             testFile1.lastModified() == destination.lastModified());*/
@@ -598,7 +599,7 @@
 
     @Test
     public void copyToSelf() throws IOException {
-        File destination = new File(tempFolder.getRoot(), "copy3.txt");
+        File destination = new File(tempFolder, "copy3.txt");
         // Prepare a test file
         FileUtils.copyFile(testFile1, destination);
 
@@ -609,7 +610,7 @@
     public void copyDirectoryToNonExistingDest() throws Exception {
         createFile(testFile1, 1234);
         createFile(testFile2, 4321);
-        File srcDir = tempFolder.getRoot();
+        File srcDir = tempFolder;
         File subDir = new File(srcDir, "sub");
         subDir.mkdir();
         File subFile = new File(subDir, "A.txt");
@@ -629,7 +630,7 @@
     public void copyDirectoryToExistingDest() throws IOException {
         createFile(testFile1, 1234);
         createFile(testFile2, 4321);
-        File srcDir = tempFolder.getRoot();
+        File srcDir = tempFolder;
         File subDir = new File(srcDir, "sub");
         assertTrue(subDir.mkdir());
         File subFile = new File(subDir, "A.txt");
@@ -656,7 +657,7 @@
     @Test
     public void copyDirectoryErrorsCopyToSelf() {
         try {
-            FileUtils.copyDirectory(tempFolder.getRoot(), tempFolder.getRoot());
+            FileUtils.copyDirectory(tempFolder, tempFolder);
             fail();
         } catch (IOException ex) {
         }
@@ -675,7 +676,7 @@
         } catch (NullPointerException ex) {
         }
         try {
-            FileUtils.copyDirectory(tempFolder.getRoot(), testFile1);
+            FileUtils.copyDirectory(tempFolder, testFile1);
             fail();
         } catch (IOException ex) {
         }
@@ -685,27 +686,27 @@
 
     @Test
     public void forceDeleteAFile1() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy1.txt");
+        File destination = new File(tempFolder, "copy1.txt");
         destination.createNewFile();
-        assertTrue("Copy1.txt doesn't exist to delete", destination.exists());
+        assertTrue(destination.exists(), "Copy1.txt doesn't exist to delete");
         FileUtils.forceDelete(destination);
         assertFalse(destination.exists());
     }
 
     @Test
     public void forceDeleteAFile2() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "copy2.txt");
+        File destination = new File(tempFolder, "copy2.txt");
         destination.createNewFile();
-        assertThat("Copy2.txt doesn't exist to delete", destination.exists(), is(true));
+        assertTrue(destination.exists(), "Copy2.txt doesn't exist to delete");
         FileUtils.forceDelete(destination);
-        assertThat("Check No Exist", !destination.exists(), is(true));
+        assertTrue(!destination.exists(), "Check No Exist");
     }
 
     @Test
-    @Ignore("Commons test case that is failing for plexus")
+    @Disabled("Commons test case that is failing for plexus")
     public void forceDeleteAFile3() throws Exception {
-        File destination = new File(tempFolder.getRoot(), "no_such_file");
-        assertThat("Check No Exist", !destination.exists(), is(true));
+        File destination = new File(tempFolder, "no_such_file");
+        assertTrue(!destination.exists(), "Check No Exist");
         try {
             FileUtils.forceDelete(destination);
             fail("Should generate FileNotFoundException");
@@ -716,9 +717,9 @@
     // copyFileToDirectory
 
     @Test
-    @Ignore("Commons test case that is failing for plexus")
+    @Disabled("Commons test case that is failing for plexus")
     public void copyFile1ToDir() throws Exception {
-        File directory = new File(tempFolder.getRoot(), "subdir");
+        File directory = new File(tempFolder, "subdir");
         if (!directory.exists()) {
             directory.mkdirs();
         }
@@ -729,8 +730,8 @@
         // the lastModified date is not ok
 
         FileUtils.copyFileToDirectory(testFile1, directory);
-        assertThat("Check Exist", destination.exists(), is(true));
-        assertThat("Check Full copy", destination.length(), is(testFile1Size));
+        assertTrue(destination.exists(), "Check Exist");
+        assertEquals(testFile1Size, destination.length(), "Check Full copy");
         /* disabled: Thread.sleep doesn't work reliantly for this case
         assertTrue("Check last modified date preserved",
             testFile1.lastModified() == destination.lastModified());*/
@@ -745,7 +746,7 @@
 
     @Test
     public void copyFile2ToDir() throws Exception {
-        File directory = new File(tempFolder.getRoot(), "subdir");
+        File directory = new File(tempFolder, "subdir");
         if (!directory.exists()) {
             directory.mkdirs();
         }
@@ -756,8 +757,8 @@
         // the lastModified date is not ok
 
         FileUtils.copyFileToDirectory(testFile1, directory);
-        assertThat("Check Exist", destination.exists(), is(true));
-        assertThat("Check Full copy", destination.length(), is(testFile2Size));
+        assertTrue(destination.exists(), "Check Exist");
+        assertEquals(testFile2Size, destination.length(), "Check Full copy");
         /* disabled: Thread.sleep doesn't work reliantly for this case
         assertTrue("Check last modified date preserved",
             testFile1.lastModified() == destination.lastModified());*/
@@ -767,9 +768,9 @@
 
     @Test
     public void forceDeleteDir() throws Exception {
-        File testDirectory = tempFolder.newFolder(name.getMethodName());
+        File testDirectory = newFolder(tempFolder, name);
         FileUtils.forceDelete(testDirectory.getParentFile());
-        assertThat("Check No Exist", !testDirectory.getParentFile().exists(), is(true));
+        assertTrue(!testDirectory.getParentFile().exists(), "Check No Exist");
     }
 
     /**
@@ -778,7 +779,7 @@
     @Test
     public void fileUtils() throws Exception {
         // Loads file from classpath
-        File file1 = new File(tempFolder.getRoot(), "test.txt");
+        File file1 = new File(tempFolder, "test.txt");
         String filename = file1.getAbsolutePath();
 
         // Create test file on-the-fly
@@ -786,47 +787,47 @@
             out.write("This is a test".getBytes("UTF-8"));
         }
 
-        File file2 = new File(tempFolder.getRoot(), "test2.txt");
+        File file2 = new File(tempFolder, "test2.txt");
 
         FileUtils.fileWrite(file2, "UTF-8", filename);
-        assertThat(file2.exists(), is(true));
-        assertThat(file2.length() > 0, is(true));
+        assertTrue(file2.exists());
+        assertTrue(file2.length() > 0);
 
         String file2contents = FileUtils.fileRead(file2, "UTF-8");
-        assertThat("Second file's contents correct", filename.equals(file2contents), is(true));
+        assertTrue(filename.equals(file2contents), "Second file's contents correct");
 
-        assertThat(file2.delete(), is(true));
+        assertTrue(file2.delete());
 
         String contents = FileUtils.fileRead(new File(filename), "UTF-8");
-        assertThat("FileUtils.fileRead()", contents.equals("This is a test"), is(true));
+        assertTrue(contents.equals("This is a test"), "FileUtils.fileRead()");
     }
 
     @Test
     public void fileReadWithDefaultEncoding() throws Exception {
-        File file = new File(tempFolder.getRoot(), "read.obj");
+        File file = new File(tempFolder, "read.obj");
         FileOutputStream out = new FileOutputStream(file);
         byte[] text = "Hello /u1234".getBytes();
         out.write(text);
         out.close();
 
         String data = FileUtils.fileRead(file);
-        assertThat(data, is("Hello /u1234"));
+        assertEquals("Hello /u1234", data);
     }
 
     @Test
     public void fileReadWithEncoding() throws Exception {
-        File file = new File(tempFolder.getRoot(), "read.obj");
+        File file = new File(tempFolder, "read.obj");
         FileOutputStream out = new FileOutputStream(file);
         byte[] text = "Hello /u1234".getBytes("UTF8");
         out.write(text);
         out.close();
 
         String data = FileUtils.fileRead(file, "UTF8");
-        assertThat(data, is("Hello /u1234"));
+        assertEquals("Hello /u1234", data);
     }
 
     @Test
-    @Ignore("Commons test case that is failing for plexus")
+    @Disabled("Commons test case that is failing for plexus")
     public void readLines() throws Exception {
         File file = FileTestHelper.newFile(tempFolder, "lines.txt");
         try {
@@ -834,7 +835,7 @@
             FileTestHelper.createLineBasedFile(file, data);
 
             List<String> lines = FileUtils.loadFile(file);
-            assertThat(lines, is(Arrays.asList(data)));
+            assertIterableEquals(Arrays.asList(data), lines);
         } finally {
             deleteFile(file);
         }
@@ -842,7 +843,7 @@
 
     @Test
     public void writeStringToFile1() throws Exception {
-        File file = new File(tempFolder.getRoot(), "write.txt");
+        File file = new File(tempFolder, "write.txt");
         FileUtils.fileWrite(file, "UTF8", "Hello /u1234");
         byte[] text = "Hello /u1234".getBytes("UTF8");
         assertEqualContent(text, file);
@@ -850,7 +851,7 @@
 
     @Test
     public void writeStringToFile2() throws Exception {
-        File file = new File(tempFolder.getRoot(), "write.txt");
+        File file = new File(tempFolder, "write.txt");
         FileUtils.fileWrite(file, null, "Hello /u1234");
         byte[] text = "Hello /u1234".getBytes();
         assertEqualContent(text, file);
@@ -858,7 +859,7 @@
 
     @Test
     public void writeCharSequence1() throws Exception {
-        File file = new File(tempFolder.getRoot(), "write.txt");
+        File file = new File(tempFolder, "write.txt");
         FileUtils.fileWrite(file, "UTF8", "Hello /u1234");
         byte[] text = "Hello /u1234".getBytes("UTF8");
         assertEqualContent(text, file);
@@ -866,7 +867,7 @@
 
     @Test
     public void writeCharSequence2() throws Exception {
-        File file = new File(tempFolder.getRoot(), "write.txt");
+        File file = new File(tempFolder, "write.txt");
         FileUtils.fileWrite(file, null, "Hello /u1234");
         byte[] text = "Hello /u1234".getBytes();
         assertEqualContent(text, file);
@@ -881,7 +882,7 @@
 
         String expected = "This line was there before you..." + "this is brand new data";
         String actual = FileUtils.fileRead(file);
-        assertThat(actual, is(expected));
+        assertEquals(expected, actual);
     }
 
     @Test
@@ -893,12 +894,12 @@
 
         String expected = "This line was there before you..." + "this is brand new data";
         String actual = FileUtils.fileRead(file);
-        assertThat(actual, is(expected));
+        assertEquals(expected, actual);
     }
 
     @Test
     public void writeStringArrayToFile() throws Exception {
-        File file = new File(tempFolder.getRoot(), "writeArray.txt");
+        File file = new File(tempFolder, "writeArray.txt");
         FileUtils.fileWriteArray(file, new String[] {"line1", "line2", "line3"});
 
         byte[] text = "line1\nline2\nline3".getBytes(StandardCharsets.UTF_8);
@@ -907,7 +908,7 @@
 
     @Test
     public void writeStringArrayToFileWithEncoding() throws Exception {
-        File file = new File(tempFolder.getRoot(), "writeArray.txt");
+        File file = new File(tempFolder, "writeArray.txt");
         FileUtils.fileWriteArray(file, "UTF8", new String[] {"line1", "line2", "line3"});
 
         byte[] text = "line1\nline2\nline3".getBytes(StandardCharsets.UTF_8);
@@ -923,7 +924,7 @@
 
         String expected = "This line was there before you..." + "this is brand new data";
         String actual = FileUtils.fileRead(file);
-        assertThat(actual, is(expected));
+        assertEquals(expected, actual);
     }
 
     @Test
@@ -935,42 +936,42 @@
 
         String expected = "This line was there before you..." + "this is brand new data";
         String actual = FileUtils.fileRead(file);
-        assertThat(actual, is(expected));
+        assertEquals(expected, actual);
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void blowUpOnNull() throws IOException {
-        FileUtils.deleteDirectory((File) null);
+        assertThrows(NullPointerException.class, () -> FileUtils.deleteDirectory((File) null));
     }
 
     @Test
     public void deleteQuietlyDir() throws IOException {
-        File testDirectory = new File(tempFolder.getRoot(), "testDeleteQuietlyDir");
+        File testDirectory = new File(tempFolder, "testDeleteQuietlyDir");
         File testFile = new File(testDirectory, "testDeleteQuietlyFile");
         testDirectory.mkdirs();
         createFile(testFile, 0);
 
-        assertThat(testDirectory.exists(), is(true));
-        assertThat(testFile.exists(), is(true));
+        assertTrue(testDirectory.exists());
+        assertTrue(testFile.exists());
         FileUtils.deleteDirectory(testDirectory);
-        assertThat("Check No Exist", testDirectory.exists(), is(false));
-        assertThat("Check No Exist", testFile.exists(), is(false));
+        assertFalse(testDirectory.exists(), "Check No Exist");
+        assertFalse(testFile.exists(), "Check No Exist");
     }
 
     @Test
     public void deleteQuietlyFile() throws IOException {
-        File testFile = new File(tempFolder.getRoot(), "testDeleteQuietlyFile");
+        File testFile = new File(tempFolder, "testDeleteQuietlyFile");
         createFile(testFile, 0);
 
-        assertThat(testFile.exists(), is(true));
+        assertTrue(testFile.exists());
         FileUtils.deleteDirectory(testFile);
-        assertThat("Check No Exist", testFile.exists(), is(false));
+        assertFalse(testFile.exists(), "Check No Exist");
     }
 
     @Test
     public void deleteQuietlyNonExistent() throws IOException {
-        File testFile = new File(tempFolder.getRoot(), "testDeleteQuietlyNonExistent");
-        assertThat(testFile.exists(), is(false));
+        File testFile = new File(tempFolder, "testDeleteQuietlyNonExistent");
+        assertFalse(testFile.exists());
 
         FileUtils.deleteDirectory(testFile);
     }
@@ -979,228 +980,238 @@
 
     @Test
     public void getDefaultExcludes() throws Exception {
-        assertThat(Arrays.asList(FileUtils.getDefaultExcludes()), hasItems(MINIMUM_DEFAULT_EXCLUDES));
+        List<String> excludes = Arrays.asList(FileUtils.getDefaultExcludes());
+        assertAll(
+                "All minimum default excludes should be present",
+                Arrays.stream(MINIMUM_DEFAULT_EXCLUDES)
+                        .map(exclude -> () -> assertTrue(excludes.contains(exclude), "Missing exclude: " + exclude)));
     }
 
     //// getDefaultExcludesAsList
 
     @Test
     public void getDefaultExcludesAsList() throws Exception {
-        assertThat(FileUtils.getDefaultExcludesAsList(), hasItems(MINIMUM_DEFAULT_EXCLUDES));
+        List<String> excludes = FileUtils.getDefaultExcludesAsList();
+        assertAll(
+                "All minimum default excludes should be present",
+                Arrays.stream(MINIMUM_DEFAULT_EXCLUDES)
+                        .map(exclude -> () -> assertTrue(excludes.contains(exclude), "Missing exclude: " + exclude)));
     }
 
     //// getDefaultExcludesAsString
 
     @Test
     public void getDefaultExcludesAsString() throws Exception {
-        assertThat(
-                new HashSet<>(
-                        Arrays.asList(FileUtils.getDefaultExcludesAsString().split(","))),
-                hasItems(MINIMUM_DEFAULT_EXCLUDES));
+        HashSet<String> excludes = new HashSet<>(
+                Arrays.asList(FileUtils.getDefaultExcludesAsString().split(",")));
+        assertAll(
+                "All minimum default excludes should be present",
+                Arrays.stream(MINIMUM_DEFAULT_EXCLUDES)
+                        .map(exclude -> () -> assertTrue(excludes.contains(exclude), "Missing exclude: " + exclude)));
     }
 
     //// dirname(String)
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void blowUpOnDirnameNull() throws Exception {
-        FileUtils.dirname(null);
+        assertThrows(NullPointerException.class, () -> FileUtils.dirname(null));
     }
 
     @Test
     public void dirnameEmpty() throws Exception {
-        assertThat(FileUtils.dirname(""), is(""));
+        assertEquals("", FileUtils.dirname(""));
     }
 
     @Test
     public void dirnameFilename() throws Exception {
-        assertThat(FileUtils.dirname("foo.bar.txt"), is(""));
+        assertEquals("", FileUtils.dirname("foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void dirnameWindowsRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.dirname("C:\\foo.bar.txt"), is(""));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("", FileUtils.dirname("C:\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void dirnameWindowsNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.dirname("C:\\test\\foo.bar.txt"), is(""));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("", FileUtils.dirname("C:\\test\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void dirnameUnixRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.dirname("/foo.bar.txt"), is(""));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("", FileUtils.dirname("/foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void dirnameUnixNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.dirname("/test/foo.bar.txt"), is(""));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("", FileUtils.dirname("/test/foo.bar.txt"));
     }
 
     @Test
     public void dirnameWindowsRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.dirname("C:\\foo.bar.txt"), is("C:"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("C:", FileUtils.dirname("C:\\foo.bar.txt"));
     }
 
     @Test
     public void dirnameWindowsNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.dirname("C:\\test\\foo.bar.txt"), is("C:\\test"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("C:\\test", FileUtils.dirname("C:\\test\\foo.bar.txt"));
     }
 
     @Test
     public void dirnameUnixRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.dirname("/foo.bar.txt"), is(""));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("", FileUtils.dirname("/foo.bar.txt"));
     }
 
     @Test
     public void dirnameUnixNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.dirname("/test/foo.bar.txt"), is("/test"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("/test", FileUtils.dirname("/test/foo.bar.txt"));
     }
 
     //// filename(String)
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void blowUpOnFilenameNull() throws Exception {
-        FileUtils.filename(null);
+        assertThrows(NullPointerException.class, () -> FileUtils.filename(null));
     }
 
     @Test
     public void filenameEmpty() throws Exception {
-        assertThat(FileUtils.filename(""), is(""));
+        assertEquals("", FileUtils.filename(""));
     }
 
     @Test
     public void filenameFilename() throws Exception {
-        assertThat(FileUtils.filename("foo.bar.txt"), is("foo.bar.txt"));
+        assertEquals("foo.bar.txt", FileUtils.filename("foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void filenameWindowsRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.filename("C:\\foo.bar.txt"), is("C:\\foo.bar.txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("C:\\foo.bar.txt", FileUtils.filename("C:\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void filenameWindowsNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.filename("C:\\test\\foo.bar.txt"), is("C:\\test\\foo.bar.txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("C:\\test\\foo.bar.txt", FileUtils.filename("C:\\test\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void filenameUnixRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.filename("/foo.bar.txt"), is("/foo.bar.txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("/foo.bar.txt", FileUtils.filename("/foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void filenameUnixNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.filename("/test/foo.bar.txt"), is("/test/foo.bar.txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("/test/foo.bar.txt", FileUtils.filename("/test/foo.bar.txt"));
     }
 
     @Test
     public void filenameWindowsRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.filename("C:\\foo.bar.txt"), is("foo.bar.txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("foo.bar.txt", FileUtils.filename("C:\\foo.bar.txt"));
     }
 
     @Test
     public void filenameWindowsNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.filename("C:\\test\\foo.bar.txt"), is("foo.bar.txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("foo.bar.txt", FileUtils.filename("C:\\test\\foo.bar.txt"));
     }
 
     @Test
     public void filenameUnixRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.filename("/foo.bar.txt"), is("foo.bar.txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("foo.bar.txt", FileUtils.filename("/foo.bar.txt"));
     }
 
     @Test
     public void filenameUnixNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.filename("/test/foo.bar.txt"), is("foo.bar.txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("foo.bar.txt", FileUtils.filename("/test/foo.bar.txt"));
     }
 
     //// extension(String)
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void blowUpOnNullExtension() throws Exception {
-        FileUtils.extension(null);
+        assertThrows(NullPointerException.class, () -> FileUtils.extension(null));
     }
 
     @Test
     public void extensionEmpty() throws Exception {
-        assertThat(FileUtils.extension(""), is(""));
+        assertEquals("", FileUtils.extension(""));
     }
 
     @Test
     public void extensionFileName() throws Exception {
-        assertThat(FileUtils.extension("foo.bar.txt"), is("txt"));
+        assertEquals("txt", FileUtils.extension("foo.bar.txt"));
     }
 
     @Test
     public void extensionFileNameNoExtension() throws Exception {
-        assertThat(FileUtils.extension("foo_bar_txt"), is(""));
+        assertEquals("", FileUtils.extension("foo_bar_txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void extensionWindowsRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.extension("C:\\foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("txt", FileUtils.extension("C:\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void extensionWindowsNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.extension("C:\\test\\foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("txt", FileUtils.extension("C:\\test\\foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void extensionUnixRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.extension("/foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("txt", FileUtils.extension("/foo.bar.txt"));
     }
 
     @Test
     // X @ReproducesPlexusBug( "assumes that the path is a local path" )
     public void extensionUnixNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.extension("/test/foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("txt", FileUtils.extension("/test/foo.bar.txt"));
     }
 
     @Test
     public void extensionWindowsRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.extension("C:\\foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("txt", FileUtils.extension("C:\\foo.bar.txt"));
     }
 
     @Test
     public void extensionWindowsNonRootPathOnWindows() throws Exception {
-        assumeThat(File.separatorChar, is('\\'));
-        assertThat(FileUtils.extension("C:\\test\\foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '\\');
+        assertEquals("txt", FileUtils.extension("C:\\test\\foo.bar.txt"));
     }
 
     @Test
-    @Ignore("Wait until we can run with assembly 2.5 which will support symlinks properly")
+    @Disabled("Wait until we can run with assembly 2.5 which will support symlinks properly")
     public void isASymbolicLink() throws IOException {
         // This testcase will pass when running under java7 or higher
         assumeFalse(Os.isFamily(Os.FAMILY_WINDOWS));
@@ -1210,7 +1221,7 @@
     }
 
     @Test
-    @Ignore("Wait until we can run with assembly 2.5 which will support symlinks properly")
+    @Disabled("Wait until we can run with assembly 2.5 which will support symlinks properly")
     public void notASymbolicLink() throws IOException {
         File file = new File("src/test/resources/symlinks/src/");
         assertFalse(FileUtils.isSymbolicLink(file));
@@ -1218,14 +1229,14 @@
 
     @Test
     public void extensionUnixRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.extension("/foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("txt", FileUtils.extension("/foo.bar.txt"));
     }
 
     @Test
     public void extensionUnixNonRootPathOnUnix() throws Exception {
-        assumeThat(File.separatorChar, is('/'));
-        assertThat(FileUtils.extension("/test/foo.bar.txt"), is("txt"));
+        assumeTrue(File.separatorChar == '/');
+        assertEquals("txt", FileUtils.extension("/test/foo.bar.txt"));
     }
 
     @Test
@@ -1246,7 +1257,7 @@
 
         // Arrange
 
-        final File symlink1 = new File(tempFolder.getRoot(), "symlink");
+        final File symlink1 = new File(tempFolder, "symlink");
 
         FileUtils.createSymbolicLink(symlink1, testFile1);
 
@@ -1256,7 +1267,7 @@
 
         // Assert
 
-        assertThat(Files.readSymbolicLink(symlink2.toPath()).toFile(), CoreMatchers.equalTo(testFile2));
+        assertEquals(testFile2, Files.readSymbolicLink(symlink2.toPath()).toFile());
     }
 
     //// constants for testing
@@ -1318,4 +1329,19 @@
         "**/-darcs-backup*",
         "**/.darcs-temp-mail"
     };
+
+    private static File newFile(File parent, String child) throws IOException {
+        File result = new File(parent, child);
+        result.createNewFile();
+        return result;
+    }
+
+    private static File newFolder(File root, String... subDirs) throws IOException {
+        String subFolder = String.join("/", subDirs);
+        File result = new File(root, subFolder);
+        if (!result.mkdirs()) {
+            throw new IOException("Couldn't create folders " + root);
+        }
+        return result;
+    }
 }
diff --git a/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java b/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java
index d5f1c40..ed68aa6 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java
@@ -32,12 +32,15 @@
 import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 @SuppressWarnings("deprecation")
 public class IOUtilTest {
@@ -179,34 +182,38 @@
                 IOUtil.toByteArray(new DontCloseByteArrayInputStream(IOUtil.toByteArray(probe))), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullString() throws Exception {
-        IOUtil.toByteArray((String) null);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray((String) null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullReader() throws Exception {
-        IOUtil.toByteArray((Reader) null);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray((Reader) null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullInputStream() throws Exception {
-        IOUtil.toByteArray(nullInputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray(nullInputStream()));
     }
 
-    @Test(expected = IOException.class)
+    @Test
     public void contentEqualNullNull() throws Exception {
-        IOUtil.contentEquals(null, null);
+        assertThrows(IOException.class, () -> IOUtil.contentEquals(null, null));
     }
 
-    @Test(expected = IOException.class)
+    @Test
     public void contentEqualNonNullNull() throws Exception {
-        IOUtil.contentEquals(new DontCloseByteArrayInputStream(emptyByteArray()), null);
+        assertThrows(
+                IOException.class,
+                () -> IOUtil.contentEquals(new DontCloseByteArrayInputStream(emptyByteArray()), null));
     }
 
-    @Test(expected = IOException.class)
+    @Test
     public void contentEqualNullNonNull() throws Exception {
-        IOUtil.contentEquals(new DontCloseByteArrayInputStream(emptyByteArray()), null);
+        assertThrows(
+                IOException.class,
+                () -> IOUtil.contentEquals(new DontCloseByteArrayInputStream(emptyByteArray()), null));
     }
 
     @Test
@@ -272,9 +279,9 @@
                 is(false));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArray() throws Exception {
-        IOUtil.toString(nullByteArray());
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray()));
     }
 
     @Test
@@ -288,30 +295,35 @@
         assertThat(IOUtil.toString(probe.getBytes()).getBytes(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayNegBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringEmptyByteArrayNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), -1), is(emptyString()));
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), -1), is(emptyString())));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringByteArrayNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), -1), is(probe));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), -1), is(probe));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullByteArrayZeroBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayPosBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), 1));
     }
 
     @Test
@@ -325,41 +337,49 @@
         assertThat(IOUtil.toString(probe.getBytes(), 1).getBytes(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayNullEncoding() throws Exception {
-        IOUtil.toString(nullByteArray(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringEmptyByteArrayNullEncoding() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), null), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), null), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringByteArrayNullEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), null).getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), null).getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayJunkEncoding() throws Exception {
-        IOUtil.toString(nullByteArray(), "junk");
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringEmptyByteArrayJunkEncoding() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), "junk"), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), "junk"), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringByteArrayJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), "junk").getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), "junk").getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayValidEncoding() throws Exception {
-        IOUtil.toString(nullByteArray(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "utf-16"));
     }
 
     @Test
@@ -373,109 +393,138 @@
         assertThat(IOUtil.toString(probe.getBytes("utf-16"), "utf-16").getBytes("utf-8"), is(probe.getBytes("utf-8")));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayNullEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringEmptyByteArrayNullEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), null, -1), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), null, -1), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringByteArrayNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), null, -1).getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), null, -1).getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayJunkEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), "junk", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringEmptyByteArrayJunkEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), "junk", -1), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), "junk", -1), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringByteArrayJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), "junk", -1).getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), "junk", -1).getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullByteArrayValidEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), "utf-16", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringEmptyByteArrayValidEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), "utf-16", -1), is(emptyString()));
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), "utf-16", -1), is(emptyString())));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringByteArrayValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(probe.getBytes("utf-16"), "utf-16", -1).getBytes("utf-8"), is(probe.getBytes("utf-8")));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(probe.getBytes("utf-16"), "utf-16", -1).getBytes("utf-8"),
+                    is(probe.getBytes("utf-8")));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullByteArrayNullEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringEmptyByteArrayNullEncodingZeroBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), null, 0), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), null, 0), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringByteArrayNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), null, 0).getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), null, 0).getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullByteArrayJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), "junk", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringEmptyByteArrayJunkEncodingZeroBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyByteArray(), "junk", 0), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyByteArray(), "junk", 0), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringByteArrayJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(probe.getBytes(), "junk", 0).getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(probe.getBytes(), "junk", 0).getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullByteArrayValidEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullByteArray(), "utf-16", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullByteArray(), "utf-16", 0));
     }
 
     /*
      * copy(byte[],OutputStream)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullOutputStream() throws Exception {
-        IOUtil.copy(nullByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidOutputStream() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream());
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullOutputStream() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullOutputStream()));
     }
 
     @Test
@@ -495,19 +544,20 @@
      * copy(byte[],OutputStream,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream());
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullOutputStream()));
     }
 
     @Test
@@ -523,27 +573,33 @@
         assertThat(outputStream.toByteArray(), is(input));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream());
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullOutputStream()));
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayValidOutputStreamZeroBufSz() throws Exception {
         IOUtil.copy(emptyByteArray(), new DontCloseByteArrayOutputStream());
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayValidOutputStreamZeroBufSz() throws Exception {
         ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
         byte[] input = {1, 2, 3, 4, 5, 6};
@@ -551,27 +607,33 @@
         assertThat(outputStream.toByteArray(), is(input));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream());
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseByteArrayOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullOutputStream()));
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayValidOutputStreamPosBufSz() throws Exception {
         IOUtil.copy(emptyByteArray(), new DontCloseByteArrayOutputStream());
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayValidOutputStreamPosBufSz() throws Exception {
         ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
         byte[] input = {1, 2, 3, 4, 5, 6};
@@ -579,14 +641,15 @@
         assertThat(outputStream.toByteArray(), is(input));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullOutputStream() throws Exception {
-        IOUtil.copy(nullInputStream(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidOutputStream() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseByteArrayOutputStream());
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseByteArrayOutputStream()));
     }
 
     @Test
@@ -607,75 +670,93 @@
         assertThat(outputStream.toByteArray(), is(input));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyNullInputStreamNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullOutputStream(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(nullInputStream(), nullOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyNullInputStreamValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseByteArrayOutputStream(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseByteArrayOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), nullOutputStream(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), nullOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), new DontCloseByteArrayOutputStream(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(
+                        new DontCloseByteArrayInputStream(emptyByteArray()), new DontCloseByteArrayOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyInputStreamValidOutputStreamNegBufSz() throws Exception {
-        ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
-        byte[] input = {1, 2, 3, 4, 5, 6};
-        IOUtil.copy(new DontCloseByteArrayInputStream(input), outputStream, -1);
-        assertThat(outputStream.toByteArray(), is(input));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
+            byte[] input = {1, 2, 3, 4, 5, 6};
+            IOUtil.copy(new DontCloseByteArrayInputStream(input), outputStream, -1);
+            assertThat(outputStream.toByteArray(), is(input));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new ByteArrayOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new ByteArrayOutputStream(), 0));
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamNullOutputStreamZeroBufSz() throws Exception {
         IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), nullOutputStream(), 0);
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamValidOutputStreamZeroBufSz() throws Exception {
         IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), new DontCloseByteArrayOutputStream(), 0);
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullOutputStream(), 1));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new ByteArrayOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new ByteArrayOutputStream(), 1));
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamNullOutputStreamPosBufSz() throws Exception {
         IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), nullOutputStream(), 1);
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamValidOutputStreamPosBufSz() throws Exception {
         IOUtil.copy(new DontCloseByteArrayInputStream(emptyByteArray()), new DontCloseByteArrayOutputStream(), 1);
     }
 
-    @Test(timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyInputStreamValidOutputStreamPosBufSz() throws Exception {
         ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
         byte[] input = {1, 2, 3, 4, 5, 6};
@@ -683,9 +764,9 @@
         assertThat(outputStream.toByteArray(), is(input));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStream() throws Exception {
-        IOUtil.toString(nullInputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream()));
     }
 
     @Test
@@ -699,30 +780,35 @@
         assertThat(IOUtil.toString(new ByteArrayInputStream(probe.getBytes())).getBytes(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamNegBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringEmptyInputStreamNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), -1), is(emptyString()));
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), -1), is(emptyString())));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringInputStreamNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), -1), is(probe));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), -1), is(probe));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullInputStreamZeroBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamPosBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), 1));
     }
 
     @Test
@@ -737,47 +823,55 @@
                 IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), 1).getBytes(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamNullEncoding() throws Exception {
-        IOUtil.toString(nullInputStream(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringEmptyInputStreamNullEncoding() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), null), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), null), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringInputStreamNullEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null)
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null)
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamJunkEncoding() throws Exception {
-        IOUtil.toString(nullInputStream(), "junk");
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringEmptyInputStreamJunkEncoding() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), "junk"), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), "junk"), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringInputStreamJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk")
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk")
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamValidEncoding() throws Exception {
-        IOUtil.toString(nullInputStream(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "utf-16"));
     }
 
     @Test
@@ -794,118 +888,145 @@
                 is(probe.getBytes("utf-8")));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamNullEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringEmptyInputStreamNullEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), null, -1), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), null, -1), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringInputStreamNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null, -1)
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null, -1)
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamJunkEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), "junk", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringEmptyInputStreamJunkEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), "junk", -1), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), "junk", -1), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void toStringInputStreamJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk", -1)
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk", -1)
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullInputStreamValidEncodingNegBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), "utf-16", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringEmptyInputStreamValidEncodingNegBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), "utf-16", -1), is(emptyString()));
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), "utf-16", -1), is(emptyString())));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringInputStreamValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes("utf-16")), "utf-16", -1)
-                        .getBytes("utf-8"),
-                is(probe.getBytes("utf-8")));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes("utf-16")), "utf-16", -1)
+                            .getBytes("utf-8"),
+                    is(probe.getBytes("utf-8")));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullInputStreamNullEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringEmptyInputStreamNullEncodingZeroBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), null, 0), is(emptyString()));
+        assertThrows(
+                NullPointerException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), null, 0), is(emptyString())));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringInputStreamNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null, 0)
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), null, 0)
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullInputStreamJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), "junk", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringEmptyInputStreamJunkEncodingZeroBufSz() throws Exception {
-        assertThat(IOUtil.toString(emptyInputStream(), "junk", 0), is(emptyString()));
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> assertThat(IOUtil.toString(emptyInputStream(), "junk", 0), is(emptyString())));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringInputStreamJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk", 0)
-                        .getBytes(),
-                is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toString(new ByteArrayInputStream(probe.getBytes()), "junk", 0)
+                            .getBytes(),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void toStringNullInputStreamValidEncodingZeroBufSz() throws Exception {
-        IOUtil.toString(nullInputStream(), "utf-16", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullInputStream(), "utf-16", 0));
     }
 
     /*
      * copy(InputStream,Writer)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriter() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamNullWriter() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter()));
     }
 
     @Test
@@ -915,10 +1036,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyInputStreamNullWriter() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter());
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter());
+        });
     }
 
     @Test
@@ -933,63 +1056,72 @@
      * copy(InputStream,Writer,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamValidWriterNegBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyInputStreamNullWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyInputStreamValidWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), 1));
     }
 
     @Test
@@ -1011,81 +1143,94 @@
      * copy(InputStream,Writer,String)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterNullEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterNullEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterNullEncoding() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamValidWriterNullEncoding() throws Exception {
-        IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), null);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyInputStreamNullEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterJunkEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "junk");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "junk"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterJunkEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk");
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterJunkEncoding() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), "junk");
+        assertThrows(UnsupportedEncodingException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyInputStreamValidWriterJunkEncoding() throws Exception {
-        IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), "junk");
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> IOUtil.copy(emptyInputStream(), new DontCloseStringWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyInputStreamNullWriterJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk");
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk");
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyInputStreamValidWriterJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk");
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk");
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterValidEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "utf-16"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterValidEncoding() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), "utf-16"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterValidEncoding() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16");
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16"));
     }
 
     @Test
@@ -1095,10 +1240,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyInputStreamNullWriterValidEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), nullWriter(), "utf-16");
+        });
     }
 
     @Test
@@ -1113,208 +1260,266 @@
      * copy(InputStream,Writer,String,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null, -1);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyInputStreamValidWriterNullEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyInputStream(), writer, null, -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NullPointerException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyInputStream(), writer, null, -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyInputStreamNullWriterNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), null, -1);
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyInputStreamValidWriterNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null, -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null, -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "junk", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "junk", -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk", -1);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), "junk", -1);
+        assertThrows(
+                UnsupportedEncodingException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyInputStreamJunkEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyInputStream(), writer, "junk", -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyInputStream(), writer, "junk", -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyInputStreamNullWriterJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk", -1);
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk", -1);
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyInputStreamValidWriterJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk", -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk", -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamNullWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "utf-16", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullInputStreamValidWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16", -1);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamNullWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), "utf-16", -1);
+        assertThrows(
+                NegativeArraySizeException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyInputStreamValidWriterValidEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyInputStream(), writer, "utf-16", -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyInputStream(), writer, "utf-16", -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyInputStreamNullWriterValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), nullWriter(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyInputStreamValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), writer, "utf-16", -1);
-        assertThat(writer.toString().getBytes("utf-8"), is(probe.getBytes("utf-8")));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes("utf-16")), writer, "utf-16", -1);
+            assertThat(writer.toString().getBytes("utf-8"), is(probe.getBytes("utf-8")));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null, 0);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamNullWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamValidWriterNullEncodingZeroBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyInputStream(), writer, null, 0);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NullPointerException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyInputStream(), writer, null, 0);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyInputStreamNullWriterNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), null, 0);
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyInputStreamValidWriterNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null, 0);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, null, 0);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "junk", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "junk", 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk", 0);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamNullWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(emptyInputStream(), nullWriter(), "junk", 0);
+        assertThrows(
+                UnsupportedEncodingException.class, () -> IOUtil.copy(emptyInputStream(), nullWriter(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyInputStreamValidWriterJunkEncodingZeroBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyInputStream(), writer, "junk", 0);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyInputStream(), writer, "junk", 0);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyInputStreamNullWriterJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk", 0);
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), nullWriter(), "junk", 0);
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyInputStreamValidWriterJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk", 0);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new ByteArrayInputStream(probe.getBytes()), writer, "junk", 0);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamNullWriterValidEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), nullWriter(), "utf-16", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullInputStream(), nullWriter(), "utf-16", 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullInputStreamValidWriterValidEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16", 0);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullInputStream(), new DontCloseStringWriter(), "utf-16", 0));
     }
 
     /*
      * copy(String,Writer)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringNullWriter() throws Exception {
-        IOUtil.copy(nullString(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), nullWriter()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyStringNullWriter() throws Exception {
-        IOUtil.copy(emptyString(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyString(), nullWriter()));
     }
 
     @Test
@@ -1329,10 +1534,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyStringNullWriter() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe, nullWriter());
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe, nullWriter());
+        });
     }
 
     @Test
@@ -1343,19 +1550,19 @@
         assertThat(writer.toString(), is(probe));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringNullOutputStream() throws Exception {
-        IOUtil.copy(nullString(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyStringNullOutputStream() throws Exception {
-        IOUtil.copy(emptyString(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyString(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringValidOutputStream() throws Exception {
-        IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream()));
     }
 
     @Test
@@ -1365,10 +1572,12 @@
         assertThat(os.toByteArray(), is(emptyString().getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyStringNullOutputStream() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe, nullOutputStream());
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe, nullOutputStream());
+        });
     }
 
     @Test
@@ -1379,70 +1588,82 @@
         assertThat(os.toByteArray(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullString(), nullOutputStream(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), nullOutputStream(), -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyStringNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(emptyString(), nullOutputStream(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyString(), nullOutputStream(), -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), -1);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyStringValidOutputStreamNegBufSz() throws Exception {
-        ByteArrayOutputStream os = new DontCloseByteArrayOutputStream();
-        IOUtil.copy(emptyString(), os, -1);
-        assertThat(os.toByteArray(), is(emptyString().getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            ByteArrayOutputStream os = new DontCloseByteArrayOutputStream();
+            IOUtil.copy(emptyString(), os, -1);
+            assertThat(os.toByteArray(), is(emptyString().getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyStringNullOutputStreamNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe, nullOutputStream(), -1);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe, nullOutputStream(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyStringValidOutputStreamNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        ByteArrayOutputStream os = new DontCloseByteArrayOutputStream();
-        IOUtil.copy(probe, os, -1);
-        assertThat(os.toByteArray(), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            ByteArrayOutputStream os = new DontCloseByteArrayOutputStream();
+            IOUtil.copy(probe, os, -1);
+            assertThat(os.toByteArray(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullStringNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullString(), nullOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), nullOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyStringNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(emptyString(), nullOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyString(), nullOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullStringValidOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), 0);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullString(), nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullString(), nullOutputStream(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyStringNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(emptyString(), nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyString(), nullOutputStream(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullStringValidOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), 1);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullString(), new DontCloseByteArrayOutputStream(), 1));
     }
 
     @Test
@@ -1452,10 +1673,12 @@
         assertThat(os.toByteArray(), is(emptyString().getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyStringNullOutputStreamPosBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe, nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe, nullOutputStream(), 1);
+        });
     }
 
     @Test
@@ -1466,19 +1689,19 @@
         assertThat(os.toByteArray(), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderNullWriter() throws Exception {
-        IOUtil.copy(nullReader(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullWriter()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyReaderNullWriter() throws Exception {
-        IOUtil.copy(emptyReader(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullWriter()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderValidWriter() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseStringWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseStringWriter()));
     }
 
     @Test
@@ -1488,10 +1711,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyReaderNullWriter() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new StringReader(probe), nullWriter());
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new StringReader(probe), nullWriter());
+        });
     }
 
     @Test
@@ -1506,70 +1731,80 @@
      * copy(Reader,Writer,int)
      */
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyNullReaderNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(nullReader(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyReaderNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(emptyReader(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyNullReaderValidWriterNegBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseStringWriter(), -1);
+        assertThrows(
+                NegativeArraySizeException.class, () -> IOUtil.copy(nullReader(), new DontCloseStringWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyReaderValidWriterNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyReader(), writer, -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyReader(), writer, -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyReaderNullWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new StringReader(probe), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new StringReader(probe), nullWriter(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyReaderValidWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(new StringReader(probe), writer, -1);
-        assertThat(writer.toString(), is(probe));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(new StringReader(probe), writer, -1);
+            assertThat(writer.toString(), is(probe));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullReaderNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyReaderNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullReaderValidWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseStringWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseStringWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyReaderNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderValidWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseStringWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseStringWriter(), 1));
     }
 
     @Test
@@ -1579,10 +1814,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyReaderNullWriterPosBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new StringReader(probe), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new StringReader(probe), nullWriter(), 1);
+        });
     }
 
     @Test
@@ -1597,17 +1834,19 @@
      * toByteArray(InputStream,int)
      */
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toByteArrayFromInputStreamNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(
-                IOUtil.toByteArray(new DontCloseByteArrayInputStream(IOUtil.toByteArray(probe)), -1),
-                is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(
+                    IOUtil.toByteArray(new DontCloseByteArrayInputStream(IOUtil.toByteArray(probe)), -1),
+                    is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toByteArrayNullInputStreamNegBufSz() throws Exception {
-        IOUtil.toByteArray(nullInputStream(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.toByteArray(nullInputStream(), -1));
     }
 
     @Test
@@ -1618,24 +1857,26 @@
                 is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullInputStreamPosBufSz() throws Exception {
-        IOUtil.toByteArray(nullInputStream(), +1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray(nullInputStream(), +1));
     }
 
     /*
      * toByteArray(Reader,int)
      */
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toByteArrayFromReaderNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toByteArray(new DontCloseStringReader(probe), -1), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toByteArray(new DontCloseStringReader(probe), -1), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toByteArrayNullReaderNegBufSz() throws Exception {
-        IOUtil.toByteArray(nullReader(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.toByteArray(nullReader(), -1));
     }
 
     @Test
@@ -1644,24 +1885,26 @@
         assertThat(IOUtil.toByteArray(new DontCloseStringReader(probe), +1), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullReaderPosBufSz() throws Exception {
-        IOUtil.toByteArray(nullReader(), +1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray(nullReader(), +1));
     }
 
     /*
      * toByteArray(String,int)
      */
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toByteArrayFromStringNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toByteArray(probe, -1), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toByteArray(probe, -1), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullStringNegBufSz() throws Exception {
-        IOUtil.toByteArray(nullString(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray(nullString(), -1));
     }
 
     @Test
@@ -1670,24 +1913,26 @@
         assertThat(IOUtil.toByteArray(probe, +1), is(probe.getBytes()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toByteArrayNullStringPosBufSz() throws Exception {
-        IOUtil.toByteArray(nullString(), +1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toByteArray(nullString(), +1));
     }
 
     /*
      * toString(Reader,int)
      */
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringFromReaderNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        assertThat(IOUtil.toString(new DontCloseStringReader(probe), -1), is(probe));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            assertThat(IOUtil.toString(new DontCloseStringReader(probe), -1), is(probe));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void toStringNullReaderNegBufSz() throws Exception {
-        IOUtil.toString(nullReader(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.toString(nullReader(), -1));
     }
 
     @Test
@@ -1696,28 +1941,28 @@
         assertThat(IOUtil.toString(new DontCloseStringReader(probe), +1), is(probe));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void toStringNullReaderPosBufSz() throws Exception {
-        IOUtil.toString(nullReader(), +1);
+        assertThrows(NullPointerException.class, () -> IOUtil.toString(nullReader(), +1));
     }
 
     /*
      * copy(Reader,OutputStream)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderNullOutputStream() throws Exception {
-        IOUtil.copy(nullReader(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderValidOutputStream() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyReaderNullOutputStream() throws Exception {
-        IOUtil.copy(emptyReader(), nullOutputStream());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullOutputStream()));
     }
 
     @Test
@@ -1737,62 +1982,73 @@
      * copy(Reader,OutputStream,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullOutputStream(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyNullReaderValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyReaderNullOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullOutputStream(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyReaderValidOutputStreamNegBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), new DontCloseByteArrayOutputStream(), -1);
+        assertThrows(
+                NegativeArraySizeException.class,
+                () -> IOUtil.copy(emptyReader(), new DontCloseByteArrayOutputStream(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyReaderValidOutputStreamNegBufSz() throws Exception {
-        ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(new DontCloseStringReader(probe), outputStream, -1);
-        assertThat(outputStream.toByteArray(), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            ByteArrayOutputStream outputStream = new DontCloseByteArrayOutputStream();
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(new DontCloseStringReader(probe), outputStream, -1);
+            assertThat(outputStream.toByteArray(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullReaderNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullReaderValidOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), 0);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyReaderNullOutputStreamZeroBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullOutputStream(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullOutputStream(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullReader(), nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullReader(), nullOutputStream(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullReaderValidOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), 1);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullReader(), new DontCloseByteArrayOutputStream(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyReaderNullOutputStreamPosBufSz() throws Exception {
-        IOUtil.copy(emptyReader(), nullOutputStream(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyReader(), nullOutputStream(), 1));
     }
 
     @Test
@@ -1827,14 +2083,14 @@
      * copy(byte[],Writer)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriter() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullWriter() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter());
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter()));
     }
 
     @Test
@@ -1844,10 +2100,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyByteArrayNullWriter() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter());
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter());
+        });
     }
 
     @Test
@@ -1862,63 +2120,71 @@
      * copy(byte[],Writer,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyByteArrayValidWriterNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), -1);
+        assertThrows(
+                NegativeArraySizeException.class, () -> IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyByteArrayNullWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyByteArrayValidWriterNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidWriterZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayNullWriterZeroBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), 0));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterPosBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), 1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterPosBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), 1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), 1));
     }
 
     @Test
@@ -1940,81 +2206,92 @@
      * copy(byte[],Writer,String)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterNullEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterNullEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterNullEncoding() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), null);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayValidWriterNullEncoding() throws Exception {
-        IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), null);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), null));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyByteArrayNullEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, null);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, null);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterJunkEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "junk");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "junk"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterJunkEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk");
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterJunkEncoding() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), "junk");
+        assertThrows(UnsupportedEncodingException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyByteArrayValidWriterJunkEncoding() throws Exception {
-        IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), "junk");
+        assertThrows(
+                UnsupportedEncodingException.class,
+                () -> IOUtil.copy(emptyByteArray(), new DontCloseStringWriter(), "junk"));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyByteArrayNullWriterJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), "junk");
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), "junk");
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyByteArrayValidWriterJunkEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, "junk");
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, "junk");
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterValidEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "utf-16"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterValidEncoding() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), "utf-16"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterValidEncoding() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16");
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16"));
     }
 
     @Test
@@ -2024,10 +2301,12 @@
         assertThat(writer.toString(), is(emptyString()));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyByteArrayNullWriterValidEncoding() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes("utf-16"), nullWriter(), "utf-16");
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes("utf-16"), nullWriter(), "utf-16");
+        });
     }
 
     @Test
@@ -2042,194 +2321,247 @@
      * copy(byte[],Writer,String,int)
      */
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null, -1);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterNullEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), null, -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyEmptyByteArrayValidWriterNullEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyByteArray(), writer, null, -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NullPointerException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyByteArray(), writer, null, -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyByteArrayNullWriterNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), null, -1);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), null, -1);
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyByteArrayValidWriterNullEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, null, -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, null, -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "junk", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "junk", -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk", -1);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterJunkEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), "junk", -1);
+        assertThrows(UnsupportedEncodingException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), "junk", -1));
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyEmptyByteArrayJunkEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyByteArray(), writer, "junk", -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyByteArray(), writer, "junk", -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyByteArrayNullWriterJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), "junk", -1);
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), "junk", -1);
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class)
+    @Test
     public void copyByteArrayValidWriterJunkEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, "junk", -1);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, "junk", -1);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayNullWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "utf-16", -1);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void copyNullByteArrayValidWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16", -1);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyByteArrayNullWriterValidEncodingNegBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), "utf-16", -1);
+        assertThrows(NegativeArraySizeException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), "utf-16", -1));
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyEmptyByteArrayValidWriterValidEncodingNegBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyByteArray(), writer, "utf-16", -1);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyByteArray(), writer, "utf-16", -1);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyByteArrayNullWriterValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes("utf-16"), nullWriter(), -1);
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes("utf-16"), nullWriter(), -1);
+        });
     }
 
-    @Test(expected = NegativeArraySizeException.class)
+    @Test
     public void copyByteArrayValidEncodingNegBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes("utf-16"), writer, "utf-16", -1);
-        assertThat(writer.toString().getBytes("utf-8"), is(probe.getBytes("utf-8")));
+        assertThrows(NegativeArraySizeException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes("utf-16"), writer, "utf-16", -1);
+            assertThat(writer.toString().getBytes("utf-8"), is(probe.getBytes("utf-8")));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null, 0);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayNullWriterNullEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), null, 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayValidWriterNullEncodingZeroBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyByteArray(), writer, null, 0);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(NullPointerException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyByteArray(), writer, null, 0);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayNullWriterNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), null, 0);
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), null, 0);
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayValidWriterNullEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, null, 0);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(NullPointerException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, null, 0);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "junk", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "junk", 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk", 0);
+        assertThrows(
+                NullPointerException.class, () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayNullWriterJunkEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(emptyByteArray(), nullWriter(), "junk", 0);
+        assertThrows(UnsupportedEncodingException.class, () -> IOUtil.copy(emptyByteArray(), nullWriter(), "junk", 0));
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyEmptyByteArrayValidWriterJunkEncodingZeroBufSz() throws Exception {
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(emptyByteArray(), writer, "junk", 0);
-        assertThat(writer.toString(), is(emptyString()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(emptyByteArray(), writer, "junk", 0);
+            assertThat(writer.toString(), is(emptyString()));
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayNullWriterJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        IOUtil.copy(probe.getBytes(), nullWriter(), "junk", 0);
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            IOUtil.copy(probe.getBytes(), nullWriter(), "junk", 0);
+        });
     }
 
-    @Test(expected = UnsupportedEncodingException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyByteArrayValidWriterJunkEncodingZeroBufSz() throws Exception {
-        String probe = "A string \u2345\u00ef";
-        StringWriter writer = new DontCloseStringWriter();
-        IOUtil.copy(probe.getBytes(), writer, "junk", 0);
-        assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        assertThrows(UnsupportedEncodingException.class, () -> {
+            String probe = "A string \u2345\u00ef";
+            StringWriter writer = new DontCloseStringWriter();
+            IOUtil.copy(probe.getBytes(), writer, "junk", 0);
+            assertThat(writer.toString().getBytes(), is(probe.getBytes()));
+        });
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayNullWriterValidEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), nullWriter(), "utf-16", 0);
+        assertThrows(NullPointerException.class, () -> IOUtil.copy(nullByteArray(), nullWriter(), "utf-16", 0));
     }
 
-    @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT)
+    @Test
+    @Timeout(value = INFINITE_LOOP_TIMEOUT, unit = TimeUnit.MILLISECONDS)
     public void copyNullByteArrayValidWriterValidEncodingZeroBufSz() throws Exception {
-        IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16", 0);
+        assertThrows(
+                NullPointerException.class,
+                () -> IOUtil.copy(nullByteArray(), new DontCloseStringWriter(), "utf-16", 0));
     }
 
     /*
diff --git a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java
index c053294..3c88a15 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java
@@ -18,9 +18,9 @@
  */
 package org.apache.maven.shared.utils.io;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * @author Kristian Rosenvold
diff --git a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java
index 2642930..32a324e 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java
@@ -18,10 +18,10 @@
  */
 package org.apache.maven.shared.utils.io;
 
-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;
 
 /**
  * @author Kristian Rosenvold
diff --git a/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java
index 0b8a755..286c78f 100644
--- a/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java
@@ -20,10 +20,11 @@
 
 import java.io.File;
 
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test the {@link SelectorUtils} class.
@@ -31,9 +32,9 @@
 @SuppressWarnings("deprecation")
 public class SelectorUtilsTest {
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void testMatchPatternStart() {
-        SelectorUtils.matchPatternStart(null, null);
+        assertThrows(NullPointerException.class, () -> SelectorUtils.matchPatternStart(null, null));
     }
 
     @Test
diff --git a/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java b/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java
index 15e5697..bdc3eb2 100644
--- a/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java
@@ -18,8 +18,8 @@
  */
 package org.apache.maven.shared.utils.logging;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -28,7 +28,7 @@
 
     private AnsiMessageBuilder ansiMessageBuilder;
 
-    @Before
+    @BeforeEach
     public void initializeAnsiMessageBuffer() {
         this.ansiMessageBuilder = new AnsiMessageBuilder();
     }
diff --git a/src/test/java/org/apache/maven/shared/utils/logging/MessageUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/logging/MessageUtilsTest.java
index b95936f..e371e58 100644
--- a/src/test/java/org/apache/maven/shared/utils/logging/MessageUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/logging/MessageUtilsTest.java
@@ -28,13 +28,12 @@
 import org.fusesource.jansi.AnsiPrintStream;
 import org.fusesource.jansi.AnsiType;
 import org.fusesource.jansi.io.AnsiOutputStream;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeNoException;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class MessageUtilsTest {
     @Test
@@ -44,7 +43,7 @@
             MessageUtils.systemInstall();
             assertThat(System.out, not(sameInstance(currentOut)));
         } catch (LinkageError e) {
-            assumeNoException("JAnsi not supported for this platform", e);
+            //            assumeNoException("JAnsi not supported for this platform", e);
         } finally {
             try {
                 // uninstall is always necessary due to https://github.com/fusesource/jansi/issues/242
@@ -81,7 +80,7 @@
             AnsiConsole.out = new AnsiPrintStream(aos, true);
             assertEquals(33, MessageUtils.getTerminalWidth());
         } catch (LinkageError e) {
-            assumeNoException("JAnsi not supported for this platform", e);
+            //            assumeNoException("JAnsi not supported for this platform", e);
         } finally {
             try {
                 // uninstall is always necessary due to https://github.com/fusesource/jansi/issues/242
diff --git a/src/test/java/org/apache/maven/shared/utils/testhelpers/FileTestHelper.java b/src/test/java/org/apache/maven/shared/utils/testhelpers/FileTestHelper.java
index 4787469..8d07dda 100644
--- a/src/test/java/org/apache/maven/shared/utils/testhelpers/FileTestHelper.java
+++ b/src/test/java/org/apache/maven/shared/utils/testhelpers/FileTestHelper.java
@@ -26,7 +26,6 @@
 import java.io.Writer;
 
 import org.apache.commons.io.FileUtils;
-import org.junit.rules.TemporaryFolder;
 
 /**
  * A few utility methods for file based tests.
@@ -75,8 +74,8 @@
      * @return the File object for a new file
      * @throws IOException
      */
-    public static File newFile(TemporaryFolder folder, String filename) throws IOException {
-        File destination = folder.newFile(filename);
+    public static File newFile(File folder, String filename) throws IOException {
+        File destination = new File(folder, filename);
 
         if (destination.exists()) {
             FileUtils.deleteQuietly(destination);
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java b/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
index 41dee5f..e25443a 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/PrettyPrintXmlWriterTest.java
@@ -24,8 +24,8 @@
 import java.io.StringWriter;
 
 import org.apache.maven.shared.utils.StringUtils;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test of {@link PrettyPrintXMLWriter}
@@ -41,9 +41,9 @@
 
         try {
             writer.startElement("");
-            Assert.fail("allowed empty name");
+            Assertions.fail("allowed empty name");
         } catch (IllegalArgumentException ex) {
-            Assert.assertEquals("Element name cannot be empty", ex.getMessage());
+            Assertions.assertEquals("Element name cannot be empty", ex.getMessage());
         }
     }
 
@@ -57,7 +57,7 @@
 
         writer.endElement(); // Tag.HTML
 
-        Assert.assertEquals(expectedResult(), w.toString());
+        Assertions.assertEquals(expectedResult(), w.toString());
     }
 
     @Test
@@ -72,7 +72,7 @@
 
         writer.endElement(); // Tag.HTML
 
-        Assert.assertEquals(expectedResult(), w.toString());
+        Assertions.assertEquals(expectedResult(), w.toString());
     }
 
     @Test
@@ -87,7 +87,7 @@
 
         writer.endElement(); // Tag.HTML
 
-        Assert.assertEquals(expectedResult("    "), w.toString());
+        Assertions.assertEquals(expectedResult("    "), w.toString());
     }
 
     @Test
@@ -96,7 +96,7 @@
         writer.startElement(HTML.Tag.DIV.toString());
         writer.addAttribute("class", "sect\r\nion");
         writer.endElement(); // Tag.DIV
-        Assert.assertEquals("<div class=\"sect&#10;ion\"/>", w.toString());
+        Assertions.assertEquals("<div class=\"sect&#10;ion\"/>", w.toString());
     }
 
     @Test
@@ -105,7 +105,7 @@
         writer.startElement(HTML.Tag.DIV.toString());
         writer.addAttribute("class", "sect\rion");
         writer.endElement(); // Tag.DIV
-        Assert.assertEquals("<div class=\"sect&#13;ion\"/>", w.toString());
+        Assertions.assertEquals("<div class=\"sect&#13;ion\"/>", w.toString());
     }
 
     @Test
@@ -114,7 +114,7 @@
         writer.startElement(HTML.Tag.DIV.toString());
         writer.addAttribute("class", "section\r");
         writer.endElement(); // Tag.DIV
-        Assert.assertEquals("<div class=\"section&#13;\"/>", w.toString());
+        Assertions.assertEquals("<div class=\"section&#13;\"/>", w.toString());
     }
 
     @Test
@@ -123,7 +123,7 @@
         writer.startElement(HTML.Tag.DIV.toString());
         writer.addAttribute("class", "sect\nion");
         writer.endElement(); // Tag.DIV
-        Assert.assertEquals("<div class=\"sect&#10;ion\"/>", w.toString());
+        Assertions.assertEquals("<div class=\"sect&#10;ion\"/>", w.toString());
     }
 
     private void writeXhtmlHead(XMLWriter writer) throws IOException {
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
index 32f4bb9..5370ad0 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java
@@ -23,15 +23,19 @@
 import java.io.OutputStream;
 import java.io.Writer;
 
-import junit.framework.TestCase;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.WriterFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
  *
  */
-public class XmlWriterUtilTest extends TestCase {
+public class XmlWriterUtilTest {
     private OutputStream output;
 
     private Writer writer;
@@ -39,8 +43,8 @@
     private XMLWriter xmlWriter;
 
     /** {@inheritDoc} */
-    protected void setUp() throws Exception {
-        super.setUp();
+    @BeforeEach
+    public void setUp() throws Exception {
 
         output = new ByteArrayOutputStream();
         writer = WriterFactory.newXmlWriter(output);
@@ -52,6 +56,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteLineBreakXMLWriter() throws Exception {
         XmlWriterUtil.writeLineBreak(xmlWriter);
         writer.close();
@@ -63,6 +68,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteLineBreakXMLWriterInt() throws Exception {
         XmlWriterUtil.writeLineBreak(xmlWriter, 10);
         writer.close();
@@ -74,6 +80,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteLineBreakXMLWriterIntInt() throws Exception {
         XmlWriterUtil.writeLineBreak(xmlWriter, 10, 2);
         writer.close();
@@ -89,6 +96,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteLineBreakXMLWriterIntIntInt() throws Exception {
         XmlWriterUtil.writeLineBreak(xmlWriter, 10, 2, 4);
         writer.close();
@@ -101,6 +109,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentLineBreakXMLWriter() throws Exception {
         XmlWriterUtil.writeCommentLineBreak(xmlWriter);
         writer.close();
@@ -116,12 +125,14 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentLineBreakXMLWriterInt() throws Exception {
         XmlWriterUtil.writeCommentLineBreak(xmlWriter, 20);
         writer.close();
         assertEquals("<!-- ========== -->" + "\r\n", output.toString());
     }
 
+    @Test
     public void testWriteCommentLineBreak() throws IOException {
         XmlWriterUtil.writeCommentLineBreak(xmlWriter, 10);
         writer.close();
@@ -133,6 +144,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentXMLWriterString() throws Exception {
         XmlWriterUtil.writeComment(xmlWriter, "hello");
         writer.close();
@@ -143,6 +155,7 @@
         assertEquals(output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length());
     }
 
+    @Test
     public void testWriteComment() throws IOException {
         XmlWriterUtil.writeComment(
                 xmlWriter, "hellooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
@@ -154,6 +167,7 @@
         assertTrue(output.toString().length() >= XmlWriterUtil.DEFAULT_COLUMN_LINE);
     }
 
+    @Test
     public void testWriteComment2() throws IOException {
         XmlWriterUtil.writeComment(xmlWriter, "hello\nworld");
         writer.close();
@@ -171,6 +185,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentXMLWriterStringInt() throws Exception {
         String indent = StringUtils.repeat(" ", 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE);
 
@@ -186,6 +201,7 @@
                 XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE);
     }
 
+    @Test
     public void testWriteComment3() throws IOException {
         String indent = StringUtils.repeat(" ", 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE);
         XmlWriterUtil.writeComment(xmlWriter, "hello\nworld", 2);
@@ -208,6 +224,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentXMLWriterStringIntInt() throws Exception {
         String repeat = StringUtils.repeat(" ", 2 * 4);
 
@@ -221,6 +238,7 @@
         assertEquals(output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2 * 4);
     }
 
+    @Test
     public void testWriteCommentXMLWriterStringIntInt2() throws IOException {
         String repeat = StringUtils.repeat(" ", 2 * 4);
         XmlWriterUtil.writeComment(xmlWriter, "hello\nworld", 2, 4);
@@ -243,6 +261,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentXMLWriterStringIntIntInt() throws Exception {
         String indent = StringUtils.repeat(" ", 2 * 4);
 
@@ -255,6 +274,7 @@
         assertEquals(output.toString().length(), 50 - 1 + "\r\n".length() + 2 * 4);
     }
 
+    @Test
     public void testWriteCommentXMLWriterStringIntIntInt2() throws IOException {
         String indent = StringUtils.repeat(" ", 2 * 4);
         XmlWriterUtil.writeComment(xmlWriter, "hello", 2, 4, 10);
@@ -271,6 +291,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentTextXMLWriterStringInt() throws Exception {
         XmlWriterUtil.writeCommentText(xmlWriter, "hello", 0);
         writer.close();
@@ -287,6 +308,7 @@
         assertEquals(output.toString().length(), 3 * (80 - 1 + "\r\n".length()) + 2 * "\r\n".length());
     }
 
+    @Test
     public void testWriteCommentTextXMLWriterStringInt2() throws IOException {
         String indent = StringUtils.repeat(" ", 2 * 2);
 
@@ -326,6 +348,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentTextXMLWriterStringIntInt() throws Exception {
         String indent = StringUtils.repeat(" ", 2 * 4);
 
@@ -353,6 +376,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentTextXMLWriterStringIntIntInt() throws Exception {
         String indent = StringUtils.repeat(" ", 2 * 4);
 
@@ -380,6 +404,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentNull() throws Exception {
         XmlWriterUtil.writeComment(xmlWriter, null);
         writer.close();
@@ -394,6 +419,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentShort() throws Exception {
         XmlWriterUtil.writeComment(xmlWriter, "This is a short text");
         writer.close();
@@ -408,6 +434,7 @@
      *
      * @throws Exception if any
      */
+    @Test
     public void testWriteCommentLong() throws Exception {
         XmlWriterUtil.writeComment(
                 xmlWriter,
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilderTest.java b/src/test/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilderTest.java
index f532432..75b263a 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilderTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/Xpp3DomBuilderTest.java
@@ -27,12 +27,12 @@
 import java.nio.charset.StandardCharsets;
 
 import org.apache.maven.shared.utils.xml.pull.XmlPullParserException;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * @author Kristian Rosenvold
@@ -50,7 +50,7 @@
 
         String expected = expectedSelfClosingTag();
         String dom1Str = dom.toString();
-        assertEquals("check DOMs match", expected, dom1Str);
+        assertEquals(expected, dom1Str, "check DOMs match");
     }
 
     @Test
@@ -84,7 +84,7 @@
             Xpp3DomBuilder.build(new StringReader("<newRoot>" + createDomString()));
             fail("We're supposed to fail");
         } catch (XmlPullParserException ex) {
-            Assert.assertNotNull(ex.getMessage());
+            Assertions.assertNotNull(ex.getMessage());
         }
     }
 
diff --git a/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java b/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java
index 6c6ea17..acb99b1 100644
--- a/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java
+++ b/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java
@@ -23,13 +23,14 @@
 
 import org.apache.maven.shared.utils.xml.Xpp3Dom;
 import org.apache.maven.shared.utils.xml.Xpp3DomBuilder;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.apache.maven.shared.utils.xml.Xpp3Dom.mergeXpp3Dom;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * @author Kristian Rosenvold
@@ -131,16 +132,22 @@
         assertEquals(1, result.getChildren("sub").length);
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void nullValue() {
-        //noinspection ConstantConditions
-        new Xpp3Dom("top").setAttribute(null, "value");
+        assertThrows(
+                NullPointerException.class,
+                () ->
+                        //noinspection ConstantConditions
+                        new Xpp3Dom("top").setAttribute(null, "value"));
     }
 
-    @Test(expected = NullPointerException.class)
+    @Test
     public void nullAttribute() {
-        //noinspection ConstantConditions
-        new Xpp3Dom("root").setAttribute("attr", null);
+        assertThrows(
+                NullPointerException.class,
+                () ->
+                        //noinspection ConstantConditions
+                        new Xpp3Dom("root").setAttribute("attr", null));
     }
 
     @Test