You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2022/05/13 11:54:46 UTC

[tika] 07/10: TIKA-3759 -- upgrade to junit5 in tika-batch

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 6c1ec133f3d53630c115be844ad58f5e064d1790
Author: tallison <ta...@apache.org>
AuthorDate: Fri May 13 06:08:58 2022 -0400

    TIKA-3759 -- upgrade to junit5 in tika-batch
---
 tika-batch/pom.xml                                 |  7 ---
 .../tika/batch/CommandLineParserBuilderTest.java   |  2 +-
 .../RecursiveParserWrapperFSConsumerTest.java      |  4 +-
 .../org/apache/tika/batch/fs/BatchDriverTest.java  | 61 +++++++++++++---------
 .../org/apache/tika/batch/fs/BatchProcessTest.java | 61 +++++++++++++---------
 .../org/apache/tika/batch/fs/FSBatchTestBase.java  |  8 +--
 .../apache/tika/batch/fs/FSFileResourceTest.java   |  6 +--
 .../java/org/apache/tika/batch/fs/FSUtilTest.java  | 22 +++-----
 .../apache/tika/batch/fs/HandlerBuilderTest.java   |  6 +--
 .../tika/batch/fs/OutputStreamFactoryTest.java     |  8 +--
 .../tika/batch/fs/strawman/StrawmanTest.java       |  2 +-
 11 files changed, 100 insertions(+), 87 deletions(-)

diff --git a/tika-batch/pom.xml b/tika-batch/pom.xml
index eedbeee94..7bcefed4d 100644
--- a/tika-batch/pom.xml
+++ b/tika-batch/pom.xml
@@ -64,13 +64,6 @@
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
-    <!-- after we migrate everything to junit5, we can get rid of this -->
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <version>${junit5.version}</version>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-simple</artifactId>
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/CommandLineParserBuilderTest.java b/tika-batch/src/test/java/org/apache/tika/batch/CommandLineParserBuilderTest.java
index 52ec0951e..e74802289 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/CommandLineParserBuilderTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/CommandLineParserBuilderTest.java
@@ -20,7 +20,7 @@ package org.apache.tika.batch;
 import java.io.InputStream;
 
 import org.apache.commons.cli.Options;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.tika.batch.builders.CommandLineParserBuilder;
 import org.apache.tika.batch.fs.FSBatchTestBase;
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/RecursiveParserWrapperFSConsumerTest.java b/tika-batch/src/test/java/org/apache/tika/batch/RecursiveParserWrapperFSConsumerTest.java
index 7a6432780..86aaf661c 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/RecursiveParserWrapperFSConsumerTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/RecursiveParserWrapperFSConsumerTest.java
@@ -17,7 +17,7 @@
 package org.apache.tika.batch;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -29,7 +29,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ArrayBlockingQueue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.tika.TikaTest;
 import org.apache.tika.batch.fs.RecursiveParserWrapperFSConsumer;
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchDriverTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchDriverTest.java
index 1efe117db..2643bd5c7 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchDriverTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchDriverTest.java
@@ -17,9 +17,9 @@
 package org.apache.tika.batch.fs;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -27,8 +27,9 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import org.apache.tika.batch.BatchProcessDriverCLI;
 
@@ -37,7 +38,8 @@ public class BatchDriverTest extends FSBatchTestBase {
     //for debugging, turn logging off/on via resources/log4j2.properties for the driver
     //and log4j2_process.properties for the process.
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void oneHeavyHangTest() throws Exception {
         //batch runner hits one heavy hang file, keep going
         Path outputDir = getNewOutputDir("daemon-");
@@ -57,7 +59,8 @@ public class BatchDriverTest extends FSBatchTestBase {
                 readFileToString(outputDir.resolve("test2_ok.xml.xml"), UTF_8));
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void restartOnFullHangTest() throws Exception {
         //batch runner hits more heavy hangs than threads; needs to restart
         Path outputDir = getNewOutputDir("daemon-");
@@ -75,7 +78,8 @@ public class BatchDriverTest extends FSBatchTestBase {
                 readFileToString(outputDir.resolve("test6_ok.xml.xml"), UTF_8));
     }
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void noRestartTest() throws Exception {
         Path outputDir = getNewOutputDir("daemon-");
 
@@ -93,12 +97,13 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertFalse(driver.isUserInterrupted());
         assertEquals(2, countChildren(outputDir));
         Path test2 = outputDir.resolve("test2_norestart.xml.xml");
-        assertTrue("test2_norestart.xml", Files.exists(test2));
+        assertTrue(Files.exists(test2), "test2_norestart.xml");
         Path test3 = outputDir.resolve("test3_ok.xml.xml");
-        assertFalse("test3_ok.xml", Files.exists(test3));
+        assertFalse(Files.exists(test3), "test3_ok.xml");
     }
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void restartOnOOMTest() throws Exception {
         //batch runner hits more heavy hangs than threads; needs to restart
         Path outputDir = getNewOutputDir("daemon-");
@@ -115,7 +120,8 @@ public class BatchDriverTest extends FSBatchTestBase {
                 readFileToString(outputDir.resolve("test2_ok.xml.xml"), UTF_8));
     }
 
-    @Test(timeout = 60000)
+    @Test
+    @Timeout(60000)
     public void allHeavyHangsTestWithStarvedCrawler() throws Exception {
         //this tests that if all consumers are hung and the crawler is
         //waiting to add to the queue, there isn't deadlock.  The BatchProcess should
@@ -133,7 +139,8 @@ public class BatchDriverTest extends FSBatchTestBase {
                 readFileToString(outputDir.resolve("test6_ok.xml.xml"), UTF_8));
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void maxRestarts() throws Exception {
         //tests that maxRestarts works
         //if -maxRestarts is not correctly removed from the commandline,
@@ -154,7 +161,8 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertEquals(3, countChildren(outputDir));
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void maxRestartsBadParameter() throws Exception {
         //tests that maxRestarts must be followed by an Integer
         Path outputDir = getNewOutputDir("allHeavyHangsStarvedCrawler-");
@@ -171,10 +179,11 @@ public class BatchDriverTest extends FSBatchTestBase {
         } catch (IllegalArgumentException e) {
             ex = true;
         }
-        assertTrue("IllegalArgumentException should have been thrown", ex);
+        assertTrue(ex, "IllegalArgumentException should have been thrown");
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void testNoRestartIfProcessFails() throws Exception {
         //tests that if something goes horribly wrong with FSBatchProcessCLI
         //the driver will not restart it again and again
@@ -191,7 +200,8 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertEquals(0, driver.getNumRestarts());
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void testNoRestartIfProcessFailsTake2() throws Exception {
         Path outputDir = getNewOutputDir("nostart-norestart-");
         Map<String, String> args = new HashMap<>();
@@ -206,7 +216,8 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertEquals(0, driver.getNumRestarts());
     }
 
-    @Test(timeout = 60000)
+    @Test
+    @Timeout(60000)
     public void testSystemExit() throws Exception {
         Path outputDir = getNewOutputDir("system-exit");
         Map<String, String> args = new HashMap<>();
@@ -218,8 +229,8 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertEquals(6, countChildren(outputDir));
         assertTrue(driver.getNumRestarts() > 1);
         for (int i = 0; i < 3; i++) {
-            assertEquals("problem with " + i, 0,
-                    Files.size(outputDir.resolve("test" + i + "_system_exit.xml.xml")));
+            assertEquals(0, Files.size(outputDir.resolve("test" + i + "_system_exit.xml.xml")),
+                    "problem with " + i);
         }
         //sys exit may prevent test3 from running successfully
         for (int i = 5; i < 6; i++) {
@@ -228,8 +239,9 @@ public class BatchDriverTest extends FSBatchTestBase {
         }
     }
 
-    @Test(timeout = 60000)
-    @Ignore("Java 11-ea+23 makes outputstreams uninterruptible")
+    @Test
+    @Disabled("Java 11-ea+23 makes outputstreams uninterruptible")
+    @Timeout(60000)
     public void testThreadInterrupt() throws Exception {
         Path outputDir = getNewOutputDir("thread-interrupt");
         Map<String, String> args = new HashMap<>();
@@ -241,8 +253,9 @@ public class BatchDriverTest extends FSBatchTestBase {
         assertEquals(6, countChildren(outputDir));
 
         for (int i = 0; i < 3; i++) {
-            assertEquals("problem with " + i, 0,
-                    Files.size(outputDir.resolve("test" + i + "_thread_interrupt.xml.xml")));
+            assertEquals(0,
+                    Files.size(outputDir.resolve("test" + i + "_thread_interrupt.xml.xml")),
+                    "problem with " + i);
         }
         //sys exit may prevent test3 from running successfully
         for (int i = 5; i < 6; i++) {
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchProcessTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchProcessTest.java
index 5906d4e70..3b3894767 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchProcessTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/BatchProcessTest.java
@@ -17,10 +17,10 @@
 package org.apache.tika.batch.fs;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
-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.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.io.IOException;
 import java.nio.file.Files;
@@ -29,8 +29,9 @@ import java.nio.file.Paths;
 import java.util.List;
 import java.util.Map;
 
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
 
 import org.apache.tika.batch.BatchProcess;
 import org.apache.tika.batch.BatchProcessDriverCLI;
@@ -39,10 +40,11 @@ import org.apache.tika.batch.BatchProcessDriverCLI;
  * This runs a single process.  This was useful during development,
  * but we don't need it because it is duplicative of {@link BatchDriverTest}
  */
-@Ignore("Batch Driver is the integration test")
+@Disabled("Batch Driver is the integration test")
 public class BatchProcessTest extends FSBatchTestBase {
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void oneHeavyHangTest() throws Exception {
 
         Path outputDir = getNewOutputDir("one_heavy_hang-");
@@ -59,7 +61,8 @@ public class BatchProcessTest extends FSBatchTestBase {
     }
 
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void allHeavyHangsTest() throws Exception {
         //each of the three threads hits a heavy hang.  The BatchProcess runs into
         //all timedouts and shuts down.
@@ -71,14 +74,16 @@ public class BatchProcessTest extends FSBatchTestBase {
         assertEquals(3, countChildren(outputDir));
         for (Path hvyHang : listPaths(outputDir)) {
             assertTrue(Files.exists(hvyHang));
-            assertEquals("file length for " + hvyHang.getFileName() + " should be 0, but is: " +
-                    Files.size(hvyHang), 0, Files.size(hvyHang));
+            assertEquals(0, Files.size(hvyHang),
+                    "file length for " + hvyHang.getFileName() + " should be 0, but is: " +
+                            Files.size(hvyHang));
         }
         assertContains(BatchProcess.BATCH_CONSTANTS.BATCH_PROCESS_FATAL_MUST_RESTART.toString(),
                 streamStrings.getErrString());
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void allHeavyHangsTestWithCrazyNumberConsumersTest() throws Exception {
         Path outputDir = getNewOutputDir("allHeavyHangsCrazyNumberConsumers-");
         Map<String, String> args = getDefaultArgs("heavy_heavy_hangs", outputDir);
@@ -101,7 +106,8 @@ public class BatchProcessTest extends FSBatchTestBase {
                 streamStrings.getErrString());
     }
 
-    @Test(timeout = 30000)
+    @Test
+    @Timeout(30000)
     public void allHeavyHangsTestWithStarvedCrawler() throws Exception {
         //this tests that if all consumers are hung and the crawler is
         //waiting to add to the queue, there isn't deadlock.  The batchrunner should
@@ -126,7 +132,8 @@ public class BatchProcessTest extends FSBatchTestBase {
         assertContains("Crawler timed out", streamStrings.getErrString());
     }
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void outOfMemory() throws Exception {
         //the first consumer should sleep for 10 seconds
         //the second should be tied up in a heavy hang
@@ -152,7 +159,8 @@ public class BatchProcessTest extends FSBatchTestBase {
     }
 
 
-    @Test(timeout = 15000)
+    @Test
+    @Timeout(15000)
     public void noRestart() throws Exception {
         Path outputDir = getNewOutputDir("no_restart");
 
@@ -164,9 +172,9 @@ public class BatchProcessTest extends FSBatchTestBase {
         StreamStrings streamStrings = ex.execute();
 
         Path test2 = outputDir.resolve("test2_norestart.xml.xml");
-        assertTrue("test2_norestart.xml", Files.exists(test2));
+        assertTrue(Files.exists(test2), "test2_norestart.xml");
         Path test3 = outputDir.resolve("test3_ok.xml.xml");
-        assertFalse("test3_ok.xml", Files.exists(test3));
+        assertFalse(Files.exists(test3), "test3_ok.xml");
         assertContains("exitStatus=" + BatchProcessDriverCLI.PROCESS_NO_RESTART_EXIT_CODE,
                 streamStrings.getOutString());
         assertContains("causeForTermination='MAIN_LOOP_EXCEPTION_NO_RESTART'",
@@ -180,7 +188,8 @@ public class BatchProcessTest extends FSBatchTestBase {
      * If this fails, then interruptible parsers (e.g. those with
      * nio channels) will be interrupted and there will be corrupted data.
      */
-    @Test(timeout = 60000)
+    @Test
+    @Timeout(60000)
     public void testWaitAfterEarlyTermination() throws Exception {
         Path outputDir = getNewOutputDir("wait_after_early_termination");
 
@@ -203,7 +212,8 @@ public class BatchProcessTest extends FSBatchTestBase {
                 streamStrings.getOutString());
     }
 
-    @Test(timeout = 60000)
+    @Test
+    @Timeout(60000)
     public void testTimeOutAfterBeingAskedToShutdown() throws Exception {
         Path outputDir = getNewOutputDir("timeout_after_early_termination");
 
@@ -224,7 +234,8 @@ public class BatchProcessTest extends FSBatchTestBase {
                 streamStrings.getOutString());
     }
 
-    @Test(timeout = 10000)
+    @Test
+    @Timeout(10000)
     public void testRedirectionOfStreams() throws Exception {
         //test redirection of system.err to system.out
         Path outputDir = getNewOutputDir("noisy_parsers");
@@ -241,7 +252,8 @@ public class BatchProcessTest extends FSBatchTestBase {
         assertNotContained(stderr, streamStrings.getErrString());
     }
 
-    @Test(timeout = 10000)
+    @Test
+    @Timeout(10000)
     public void testConsumersManagerInitHang() throws Exception {
         Path outputDir = getNewOutputDir("init_hang");
 
@@ -256,7 +268,8 @@ public class BatchProcessTest extends FSBatchTestBase {
                 streamStrings.getOutString());
     }
 
-    @Test(timeout = 10000)
+    @Test
+    @Timeout(10000)
     public void testConsumersManagerShutdownHang() throws Exception {
         Path outputDir = getNewOutputDir("shutdown_hang");
 
@@ -289,8 +302,8 @@ public class BatchProcessTest extends FSBatchTestBase {
         Path test1 = outputDir.resolve("test1.xml.json");
         Path test2 = outputDir.resolve("sub1a/test2.xml.json");
         Path test3 = outputDir.resolve("sub1a/sub2a/test3.xml.json");
-        assertTrue("test1 exists", Files.exists(test1));
-        assertTrue("test1 length > 10", Files.size(test1) > 10);
+        assertTrue(Files.exists(test1), "test1 exists");
+        assertTrue(Files.size(test1) > 10, "test1 length > 10");
         assertTrue(Files.exists(test3) && Files.size(test3) > 10);
         Path test2Dir = outputDir.resolve("sub1a");
         //should be just the subdirectory, no actual test2 file
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java
index 4ea394718..24c7cadac 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java
@@ -39,8 +39,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
 
 import org.apache.tika.TikaTest;
 import org.apache.tika.batch.BatchProcess;
@@ -68,14 +68,14 @@ public abstract class FSBatchTestBase extends TikaTest {
 
     private static Path outputRoot = null;
 
-    @BeforeClass
+    @BeforeAll
     public static void setUp() throws Exception {
         Path testOutput = Paths.get("target/test-classes/test-output");
         Files.createDirectories(testOutput);
         outputRoot = Files.createTempDirectory(testOutput, "tika-batch-output-root-");
     }
 
-    @AfterClass
+    @AfterAll
     public static void tearDown() throws Exception {
         //not ideal, but should be ok for testing
         //see caveat in TikaCLITest's textExtract
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSFileResourceTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSFileResourceTest.java
index b4a7b9cff..2bb795481 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSFileResourceTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSFileResourceTest.java
@@ -17,13 +17,13 @@
 
 package org.apache.tika.batch.fs;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class FSFileResourceTest {
     @Test
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSUtilTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSUtilTest.java
index f0377c6b1..7b2adc072 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/FSUtilTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/FSUtilTest.java
@@ -16,12 +16,12 @@
  */
 package org.apache.tika.batch.fs;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class FSUtilTest {
 
@@ -30,20 +30,14 @@ public class FSUtilTest {
         Path cwd = Paths.get(".");
         String windows = "C:/temp/file.txt";
         String linux = "/root/dir/file.txt";
-        boolean ex = false;
-        try {
-            FSUtil.resolveRelative(cwd, windows);
-        } catch (IllegalArgumentException e) {
-            ex = true;
-        }
+        //this test does not work on linux
+     //   assertThrows(IllegalArgumentException.class, () -> {
+       //     System.out.println(FSUtil.resolveRelative(cwd, windows));
+        //});
 
-        try {
+        assertThrows(IllegalArgumentException.class, () -> {
             FSUtil.resolveRelative(cwd, linux);
-        } catch (IllegalArgumentException e) {
-            ex = true;
-        }
-
-        assertTrue("IllegalArgumentException should have been thrown", ex);
+        });
     }
 
 }
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java
index c353be9b2..0de3db570 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/HandlerBuilderTest.java
@@ -17,13 +17,13 @@
 package org.apache.tika.batch.fs;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
-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;
 
 import java.nio.file.Path;
 import java.util.Map;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.tika.batch.BatchProcess;
 import org.apache.tika.batch.ParallelFileProcessingResult;
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java
index 5d5d292c6..dab260c8c 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/OutputStreamFactoryTest.java
@@ -16,14 +16,14 @@
  */
 package org.apache.tika.batch.fs;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.file.Path;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import org.apache.tika.batch.BatchProcess;
 import org.apache.tika.batch.ParallelFileProcessingResult;
@@ -47,7 +47,7 @@ public class OutputStreamFactoryTest extends FSBatchTestBase {
                 illegalState = true;
             }
         }
-        assertTrue("Should have been an illegal state exception", illegalState);
+        assertTrue(illegalState, "Should have been an illegal state exception");
     }
 
     @Test
diff --git a/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java b/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java
index f123c701d..61776ae6b 100644
--- a/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java
+++ b/tika-batch/src/test/java/org/apache/tika/batch/fs/strawman/StrawmanTest.java
@@ -18,7 +18,7 @@
 package org.apache.tika.batch.fs.strawman;
 
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class StrawmanTest {
     //TODO: actually write some tests!!!