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

slfan1989 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3d2f4d669ed HADOOP-19441. [JDK17] Upgrade JUnit from 4 to 5 in 
hadoop-streaming. (#7554)
3d2f4d669ed is described below

commit 3d2f4d669edcf321509ceacde58a8160aef06a8c
Author: slfan1989 <55643692+slfan1...@users.noreply.github.com>
AuthorDate: Mon Apr 7 15:38:54 2025 +0800

    HADOOP-19441. [JDK17] Upgrade JUnit from 4 to 5 in hadoop-streaming. (#7554)
    
    Co-authored-by: Chris Nauroth <cnaur...@apache.org>
    Co-authored-by: Hualong Zhang <hualon...@hotmail.com>
    Reviewed-by: Chris Nauroth <cnaur...@apache.org>
    Reviewed-by: Hualong Zhang <hualon...@hotmail.com>
    Signed-off-by: Shilun Fan <slfan1...@apache.org>
---
 .../hadoop/streaming/TestAutoInputFormat.java      | 22 +++++++++---------
 .../hadoop/streaming/TestClassWithNoPackage.java   |  8 +++----
 .../hadoop/streaming/TestDumpTypedBytes.java       | 13 +++++------
 .../org/apache/hadoop/streaming/TestFileArgs.java  |  8 +++----
 .../hadoop/streaming/TestLoadTypedBytes.java       | 12 +++++-----
 .../apache/hadoop/streaming/TestMRFramework.java   | 17 +++++++-------
 .../hadoop/streaming/TestMultipleCachefiles.java   |  4 ++--
 .../hadoop/streaming/TestRawBytesStreaming.java    |  4 ++--
 .../hadoop/streaming/TestStreamAggregate.java      |  4 ++--
 .../hadoop/streaming/TestStreamDataProtocol.java   |  4 ++--
 .../org/apache/hadoop/streaming/TestStreamJob.java | 27 ++++++++++++++--------
 .../hadoop/streaming/TestStreamReduceNone.java     |  4 ++--
 .../streaming/TestStreamXmlMultipleRecords.java    |  6 ++---
 .../org/apache/hadoop/streaming/TestStreaming.java | 15 ++++++------
 .../hadoop/streaming/TestStreamingBackground.java  | 12 +++++-----
 .../hadoop/streaming/TestStreamingBadRecords.java  | 14 +++++------
 .../hadoop/streaming/TestStreamingCombiner.java    |  4 ++--
 .../hadoop/streaming/TestStreamingCounters.java    | 11 +++++----
 .../hadoop/streaming/TestStreamingExitStatus.java  | 13 ++++++-----
 .../hadoop/streaming/TestStreamingFailure.java     |  6 ++---
 .../hadoop/streaming/TestStreamingKeyValue.java    |  4 ++--
 .../TestStreamingOutputKeyValueTypes.java          |  6 ++---
 .../streaming/TestStreamingOutputOnlyKeys.java     |  2 +-
 .../hadoop/streaming/TestStreamingSeparator.java   |  4 ++--
 .../hadoop/streaming/TestStreamingStatus.java      | 13 ++++++-----
 .../hadoop/streaming/TestStreamingStderr.java      |  6 ++---
 .../org/apache/hadoop/streaming/TestSymLink.java   |  8 ++++---
 .../hadoop/streaming/TestTypedBytesStreaming.java  | 12 +++++-----
 .../hadoop/streaming/TestUnconsumedInput.java      | 10 ++++----
 .../streaming/io/TestKeyOnlyTextOutputReader.java  | 14 +++++------
 .../mapreduce/TestStreamXmlRecordReader.java       | 14 +++++------
 .../hadoop/typedbytes/TestTypedBytesWritable.java  |  4 ++--
 32 files changed, 159 insertions(+), 146 deletions(-)

diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestAutoInputFormat.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestAutoInputFormat.java
index 4ff3f54ecfb..ec5ba74d68a 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestAutoInputFormat.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestAutoInputFormat.java
@@ -34,10 +34,10 @@
 import org.apache.hadoop.mapred.FileInputFormat;
 import org.apache.hadoop.mapred.RecordReader;
 import org.apache.hadoop.mapred.Reporter;
-import org.apache.hadoop.streaming.AutoInputFormat;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class TestAutoInputFormat {
 
@@ -93,15 +93,15 @@ public void testFormat() throws IOException {
       try {
         while (reader.next(key, value)) {
           if (key instanceof LongWritable) {
-            assertEquals("Wrong value class.", Text.class, value.getClass());
-            assertTrue("Invalid value", Integer.parseInt(((Text) value)
-              .toString()) % 10 == 0);
+            assertEquals(Text.class, value.getClass(), "Wrong value class.");
+            assertTrue(Integer.parseInt(((Text) value)
+                .toString()) % 10 == 0, "Invalid value");
           } else {
-            assertEquals("Wrong key class.", IntWritable.class, 
key.getClass());
-            assertEquals("Wrong value class.", LongWritable.class, value
-              .getClass());
-            assertTrue("Invalid key.", ((IntWritable) key).get() % 11 == 0);
-            assertTrue("Invalid value.", ((LongWritable) value).get() % 12 == 
0);
+            assertEquals(IntWritable.class, key.getClass(), "Wrong key 
class.");
+            assertEquals(LongWritable.class, value
+                .getClass(), "Wrong value class.");
+            assertTrue(((IntWritable) key).get() % 11 == 0, "Invalid key.");
+            assertTrue(((LongWritable) value).get() % 12 == 0, "Invalid 
value.");
           }
         }
       } finally {
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestClassWithNoPackage.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestClassWithNoPackage.java
index 4d5cf61af62..bd03ee80090 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestClassWithNoPackage.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestClassWithNoPackage.java
@@ -18,13 +18,13 @@
 
 package org.apache.hadoop.streaming;
 
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.net.MalformedURLException;
 
 import org.apache.hadoop.util.JarFinder;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
 import org.apache.hadoop.conf.Configuration;
 
 /**
@@ -46,7 +46,7 @@ public void testGoodClassOrNull() throws Exception {
     // Get class with no package name.
     String defaultPackage = this.getClass().getPackage().getName();
     Class c = StreamUtil.goodClassOrNull(conf, NAME, defaultPackage);
-    assertNotNull("Class " + NAME + " not found!", c);
+    assertNotNull(c, "Class " + NAME + " not found!");
   }
   public static void main(String[]args) throws Exception
   {
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestDumpTypedBytes.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestDumpTypedBytes.java
index bbfc02068e7..362f93fed07 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestDumpTypedBytes.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestDumpTypedBytes.java
@@ -28,11 +28,11 @@
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.hadoop.streaming.DumpTypedBytes;
 import org.apache.hadoop.typedbytes.TypedBytesInput;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class TestDumpTypedBytes {
 
@@ -65,7 +65,7 @@ public void testDumping() throws Exception {
       String[] args = new String[1];
       args[0] = "/typedbytestest";
       int ret = dumptb.run(args);
-      assertEquals("Return value != 0.", 0, ret);
+      assertEquals(0, ret, "Return value != 0.");
 
       ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
       TypedBytesInput tbinput = new TypedBytesInput(new DataInputStream(in));
@@ -75,12 +75,11 @@ public void testDumping() throws Exception {
         assertEquals(Long.class, key.getClass()); // offset
         Object value = tbinput.read();
         assertEquals(String.class, value.getClass());
-        assertTrue("Invalid output.",
-          Integer.parseInt(value.toString()) % 10 == 0);
+        assertTrue(Integer.parseInt(value.toString()) % 10 == 0, "Invalid 
output.");
         counter++;
         key = tbinput.read();
       }
-      assertEquals("Wrong number of outputs.", 100, counter);
+      assertEquals(100, counter, "Wrong number of outputs.");
     } finally {
       try {
         fs.close();
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestFileArgs.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestFileArgs.java
index 901abba885b..b71eb2dcb01 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestFileArgs.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestFileArgs.java
@@ -30,8 +30,8 @@
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.MiniMRCluster;
 import org.apache.hadoop.util.Shell;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
 /**
  * This class tests that the '-file' argument to streaming results
@@ -65,7 +65,7 @@ public TestFileArgs() throws IOException
     setTestDir(new File("/tmp/TestFileArgs"));
   }
 
-  @Before
+  @BeforeEach
   @Override
   public void setUp() throws IOException {
     // Set up side file
@@ -79,7 +79,7 @@ public void setUp() throws IOException {
     input = "";
   }
 
-  @After
+  @AfterEach
   @Override
   public void tearDown() {
     if (mr != null) {
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestLoadTypedBytes.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestLoadTypedBytes.java
index 0c004e7135f..e6263b9daa5 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestLoadTypedBytes.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestLoadTypedBytes.java
@@ -31,8 +31,9 @@
 import org.apache.hadoop.typedbytes.TypedBytesOutput;
 import org.apache.hadoop.typedbytes.TypedBytesWritable;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class TestLoadTypedBytes {
 
@@ -62,7 +63,7 @@ public void testLoading() throws Exception {
       String[] args = new String[1];
       args[0] = "/typedbytestest/test.seq";
       int ret = loadtb.run(args);
-      assertEquals("Return value != 0.", 0, ret);
+      assertEquals(0, ret, "Return value != 0.");
 
       Path file = new Path(root, "test.seq");
       assertTrue(fs.exists(file));
@@ -73,11 +74,10 @@ public void testLoading() throws Exception {
       while (reader.next(key, value)) {
         assertEquals(Long.class, key.getValue().getClass());
         assertEquals(String.class, value.getValue().getClass());
-        assertTrue("Invalid record.",
-          Integer.parseInt(value.toString()) % 10 == 0);
+        assertTrue(Integer.parseInt(value.toString()) % 10 == 0, "Invalid 
record.");
         counter++;
       }
-      assertEquals("Wrong number of records.", 100, counter);
+      assertEquals(100, counter, "Wrong number of records.");
     } finally {
       try {
         fs.close();
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMRFramework.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMRFramework.java
index 17dc7ad633d..e907ab8c204 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMRFramework.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMRFramework.java
@@ -17,12 +17,13 @@
  */
 package org.apache.hadoop.streaming;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapreduce.MRConfig;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestMRFramework {
 
@@ -31,18 +32,18 @@ public void testFramework() {
     JobConf jobConf = new JobConf();
     jobConf.set(JTConfig.JT_IPC_ADDRESS, MRConfig.LOCAL_FRAMEWORK_NAME);
     jobConf.set(MRConfig.FRAMEWORK_NAME, MRConfig.YARN_FRAMEWORK_NAME);
-    assertFalse("Expected 'isLocal' to be false", 
-        StreamUtil.isLocalJobTracker(jobConf));
+    assertFalse(StreamUtil.isLocalJobTracker(jobConf),
+        "Expected 'isLocal' to be false");
     
     jobConf.set(JTConfig.JT_IPC_ADDRESS, MRConfig.LOCAL_FRAMEWORK_NAME);
     jobConf.set(MRConfig.FRAMEWORK_NAME, MRConfig.CLASSIC_FRAMEWORK_NAME);
-    assertFalse("Expected 'isLocal' to be false", 
-        StreamUtil.isLocalJobTracker(jobConf));
+    assertFalse(StreamUtil.isLocalJobTracker(jobConf),
+        "Expected 'isLocal' to be false");
     
     jobConf.set(JTConfig.JT_IPC_ADDRESS, "jthost:9090");
     jobConf.set(MRConfig.FRAMEWORK_NAME, MRConfig.LOCAL_FRAMEWORK_NAME);
-    assertTrue("Expected 'isLocal' to be true", 
-        StreamUtil.isLocalJobTracker(jobConf));
+    assertTrue(StreamUtil.isLocalJobTracker(jobConf),
+        "Expected 'isLocal' to be true");
   }
 
 }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMultipleCachefiles.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMultipleCachefiles.java
index 36565e3fc1b..53fdca2d137 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMultipleCachefiles.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestMultipleCachefiles.java
@@ -26,8 +26,8 @@
 import java.util.List;
 import java.util.Map;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestRawBytesStreaming.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestRawBytesStreaming.java
index 09adb3d5fd4..9574f0ad44f 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestRawBytesStreaming.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestRawBytesStreaming.java
@@ -27,8 +27,8 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class TestRawBytesStreaming {
 
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamAggregate.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamAggregate.java
index b303c8c9772..af76f58e423 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamAggregate.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamAggregate.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import java.io.*;
 import java.nio.charset.StandardCharsets;
 
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamDataProtocol.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamDataProtocol.java
index 23bb36ba0e2..ac719718180 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamDataProtocol.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamDataProtocol.java
@@ -23,8 +23,8 @@
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * This class tests hadoopStreaming in MapReduce local mode.
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamJob.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamJob.java
index 3e9036fca92..f94d3d5c569 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamJob.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamJob.java
@@ -25,23 +25,30 @@
 import org.apache.hadoop.mapred.KeyValueTextInputFormat;
 import org.apache.hadoop.mapred.SequenceFileInputFormat;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * This class tests hadoop Streaming's StreamJob class.
  */
 public class TestStreamJob {
   
-  @Test(expected = IllegalArgumentException.class)
+  @Test
   public void testCreateJobWithExtraArgs() throws IOException {
-    ArrayList<String> dummyArgs = new ArrayList<String>();
-    dummyArgs.add("-input"); dummyArgs.add("dummy");
-    dummyArgs.add("-output"); dummyArgs.add("dummy");
-    dummyArgs.add("-mapper"); dummyArgs.add("dummy");
-    dummyArgs.add("dummy");
-    dummyArgs.add("-reducer"); dummyArgs.add("dummy");
-    StreamJob.createJob(dummyArgs.toArray(new String[] {}));
+    assertThrows(IllegalArgumentException.class, () -> {
+      ArrayList<String> dummyArgs = new ArrayList<String>();
+      dummyArgs.add("-input");
+      dummyArgs.add("dummy");
+      dummyArgs.add("-output");
+      dummyArgs.add("dummy");
+      dummyArgs.add("-mapper");
+      dummyArgs.add("dummy");
+      dummyArgs.add("dummy");
+      dummyArgs.add("-reducer");
+      dummyArgs.add("dummy");
+      StreamJob.createJob(dummyArgs.toArray(new String[] {}));
+    });
   }
   
   @Test
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamReduceNone.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamReduceNone.java
index 4bb20c76214..88d7fa7a72a 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamReduceNone.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamReduceNone.java
@@ -22,8 +22,8 @@
 import java.nio.charset.StandardCharsets;
 import org.apache.hadoop.fs.FileUtil;
 
-import static org.junit.Assert.*;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 /**
  * This class tests hadoopStreaming in MapReduce local mode.
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamXmlMultipleRecords.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamXmlMultipleRecords.java
index fc8c20dd695..2eab9693762 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamXmlMultipleRecords.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamXmlMultipleRecords.java
@@ -26,8 +26,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Tests if StreamXmlRecordReader will read the next record, _after_ the
@@ -72,7 +72,7 @@ public TestStreamXmlMultipleRecords() throws IOException {
   }
 
   @Override
-  @Before
+  @BeforeEach
   public void setUp() throws IOException {
     super.setUp();
     // Without this closeAll() call, setting of FileSystem block size is
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreaming.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreaming.java
index 5139cf617da..6f7366e3888 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreaming.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreaming.java
@@ -26,10 +26,11 @@
 import java.util.Set;
 
 import org.apache.hadoop.util.JarFinder;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.AfterEach;
+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;
 
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -101,14 +102,14 @@ protected void setTestDir(File testDir) {
     INPUT_FILE = new File(testDir, "input.txt");
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException {
     UtilTest.recursiveDelete(TEST_DIR);
-    assertTrue("Creating " + TEST_DIR, TEST_DIR.mkdirs());
+    assertTrue(TEST_DIR.mkdirs(), "Creating " + TEST_DIR);
     args.clear();
   }
 
-  @After
+  @AfterEach
   public void tearDown() {
     UtilTest.recursiveDelete(TEST_DIR);
   }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBackground.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBackground.java
index c18c283dd75..fc4420890ba 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBackground.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBackground.java
@@ -18,15 +18,15 @@
 
 package org.apache.hadoop.streaming;
 
-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.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * This class tests if hadoopStreaming background works fine. A DelayEchoApp
@@ -57,7 +57,7 @@ public TestStreamingBackground() throws IOException {
       "-jobconf", "mapreduce.task.io.sort.mb=10" 
   };
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException {
     UtilTest.recursiveDelete(TEST_DIR);
     assertTrue(TEST_DIR.mkdirs());
@@ -74,7 +74,7 @@ public void runStreamJob() throws Exception {
     StreamJob job = new StreamJob(args, mayExit);
     returnStatus = job.go();
 
-    assertEquals("Streaming Job expected to succeed", 0, returnStatus);
+    assertEquals(0, returnStatus, "Streaming Job expected to succeed");
     job.running_.killJob();
     job.running_.waitForCompletion();
   }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBadRecords.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBadRecords.java
index 5a4e3a960d2..38bdcd61cc8 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBadRecords.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingBadRecords.java
@@ -31,7 +31,7 @@
 import java.util.Properties;
 import java.util.StringTokenizer;
 
-import org.junit.BeforeClass;
+import org.junit.jupiter.api.BeforeAll;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.hadoop.fs.FileUtil;
@@ -42,11 +42,11 @@
 import org.apache.hadoop.mapred.SkipBadRecords;
 import org.apache.hadoop.mapred.Utils;
 import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-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;
 
 public class TestStreamingBadRecords extends ClusterMapReduceTestCase
 {
@@ -66,7 +66,7 @@ public class TestStreamingBadRecords extends 
ClusterMapReduceTestCase
     UtilTest.makeJavaCommand(BadApp.class, new String[]{"true"});
   private static final int INPUTSIZE=100;
 
-  @BeforeClass
+  @BeforeAll
   public static void setupClass() throws Exception {
     setupClassBase(TestStreamingBadRecords.class);
   }
@@ -78,7 +78,7 @@ public TestStreamingBadRecords() throws IOException
     utilTest.redirectIfAntJunit();
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws Exception {
     Properties props = new Properties();
     props.setProperty(JTConfig.JT_RETIREJOBS, "false");
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCombiner.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCombiner.java
index 3076d8e6ae7..07e7597d017 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCombiner.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCombiner.java
@@ -22,8 +22,8 @@
 
 import org.apache.hadoop.mapred.Counters;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class TestStreamingCombiner extends TestStreaming {
 
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCounters.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCounters.java
index 3748f4fb93a..e059e43bcc6 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCounters.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingCounters.java
@@ -18,8 +18,9 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import java.io.IOException;
 
@@ -43,11 +44,11 @@ public void testCommandLine() throws Exception {
   
   private void validateCounters() throws IOException {
     Counters counters = job.running_.getCounters();
-    assertNotNull("Counters", counters);
+    assertNotNull(counters, "Counters");
     Group group = counters.getGroup("UserCounters");
-    assertNotNull("Group", group);
+    assertNotNull(group, "Group");
     Counter counter = group.getCounterForName("InputLines");
-    assertNotNull("Counter", counter);
+    assertNotNull(counter, "Counter");
     assertEquals(3, counter.getCounter());
   }
 }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingExitStatus.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingExitStatus.java
index 411f740fcda..9cb46b45db9 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingExitStatus.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingExitStatus.java
@@ -18,9 +18,10 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import org.junit.Before;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.BeforeEach;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.*;
 import java.util.*;
@@ -62,7 +63,7 @@ protected String[] genArgs(boolean exitStatusIsFailure, 
boolean failMap) {
     };
   }
 
-  @Before
+  @BeforeEach
   public void setUp() throws IOException {
     UtilTest.recursiveDelete(TEST_DIR);
     assertTrue(TEST_DIR.mkdirs());
@@ -80,9 +81,9 @@ public void runStreamJob(boolean exitStatusIsFailure, boolean 
failMap) throws Ex
     returnStatus = job.go();
     
     if (exitStatusIsFailure) {
-      assertEquals("Streaming Job failure code expected", /*job not 
successful:*/1, returnStatus);
+      assertEquals(/*job not successful:*/1, returnStatus, "Streaming Job 
failure code expected");
     } else {
-      assertEquals("Streaming Job expected to succeed", 0, returnStatus);
+      assertEquals(0, returnStatus, "Streaming Job expected to succeed");
     }
   }
 
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingFailure.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingFailure.java
index 29901cc77d8..24ba2bbd85d 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingFailure.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingFailure.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.File;
 import java.io.IOException;
@@ -50,6 +50,6 @@ protected void setInputOutput() {
   @Test
   public void testCommandLine() throws IOException {
     int returnStatus = runStreamJob();
-    assertEquals("Streaming Job Failure code expected", 5, returnStatus);
+    assertEquals(5, returnStatus, "Streaming Job Failure code expected");
   }
 }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingKeyValue.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingKeyValue.java
index ff95bd49cea..2fd660fcfd9 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingKeyValue.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingKeyValue.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.*;
 import java.nio.charset.StandardCharsets;
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputKeyValueTypes.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputKeyValueTypes.java
index 35eb752b23a..5ad660dcd00 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputKeyValueTypes.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputKeyValueTypes.java
@@ -26,8 +26,8 @@
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapred.TextInputFormat;
 import org.apache.hadoop.mapreduce.MRJobConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.util.Iterator;
@@ -45,7 +45,7 @@ public TestStreamingOutputKeyValueTypes() throws IOException {
     input = "one line dummy input\n";
   }
 
-  @Before
+  @BeforeEach
   @Override
   public void setUp() throws IOException {
     args.clear();
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputOnlyKeys.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputOnlyKeys.java
index ee2647ea3e4..73476df8ac1 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputOnlyKeys.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingOutputOnlyKeys.java
@@ -20,7 +20,7 @@
 
 import java.io.IOException;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestStreamingOutputOnlyKeys extends TestStreaming {
 
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingSeparator.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingSeparator.java
index 66ee174be75..956d47ab9a7 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingSeparator.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingSeparator.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.streaming;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.*;
 import java.nio.charset.StandardCharsets;
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStatus.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStatus.java
index 5cdb0d4b85f..cd74ae26383 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStatus.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStatus.java
@@ -25,10 +25,11 @@
 import org.apache.hadoop.mapred.MiniMRClientCluster;
 import org.apache.hadoop.mapred.MiniMRClientClusterFactory;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.AfterEach;
+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;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -101,7 +102,7 @@ public class TestStreamingStatus {
    *
    * @throws IOException
    */
-  @Before
+  @BeforeEach
   public void setUp() throws IOException {
     conf = new JobConf();
     conf.setBoolean(JTConfig.JT_RETIREJOBS, false);
@@ -119,7 +120,7 @@ public void setUp() throws IOException {
   /**
    * Kill the cluster after the test is done.
    */
-  @After
+  @AfterEach
   public void tearDown() throws IOException {
     if (fs != null) {
       clean(fs);
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStderr.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStderr.java
index b80777968ef..08aad6e2519 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStderr.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestStreamingStderr.java
@@ -24,8 +24,8 @@
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Test that streaming consumes stderr from the streaming process
@@ -82,7 +82,7 @@ public void runStreamJob(String baseName, boolean hasInput,
 
     StreamJob job = new StreamJob(genArgs(input, output, preLines, 
duringLines, postLines), mayExit);
     returnStatus = job.go();
-    assertEquals("StreamJob success", 0, returnStatus);
+    assertEquals(0, returnStatus, "StreamJob success");
   }
 
   // This test will fail by blocking forever if the stderr isn't
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestSymLink.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestSymLink.java
index 7994952578f..b51adc0c797 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestSymLink.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestSymLink.java
@@ -25,8 +25,9 @@
 import java.util.List;
 import java.util.Map;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
@@ -53,7 +54,8 @@ public class TestSymLink
   String cacheString = "This is just the cache string";
   StreamJob job;
 
-  @Test (timeout = 120000)
+  @Test
+  @Timeout(value = 120)
   public void testSymLink() throws Exception
   {
     boolean mayExit = false;
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestTypedBytesStreaming.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestTypedBytesStreaming.java
index 02daa1894c9..fee21bad543 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestTypedBytesStreaming.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestTypedBytesStreaming.java
@@ -27,10 +27,10 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class TestTypedBytesStreaming {
 
@@ -65,8 +65,8 @@ protected String[] genArgs() {
     };
   }
 
-  @Before
-  @After
+  @BeforeEach
+  @AfterEach
   public void cleanupOutput() throws Exception {
     FileUtil.fullyDelete(OUTPUT_DIR.getAbsoluteFile());
     INPUT_FILE.delete();
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestUnconsumedInput.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestUnconsumedInput.java
index b2bc84b4f90..d741874a3ad 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestUnconsumedInput.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/TestUnconsumedInput.java
@@ -18,7 +18,7 @@
 
 package org.apache.hadoop.streaming;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.DataOutputStream;
 import java.io.File;
@@ -29,7 +29,7 @@
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestUnconsumedInput {
   protected final int EXPECTED_OUTPUT_SIZE = 10000;
@@ -91,11 +91,11 @@ public void testUnconsumedInput() throws Exception
       job = new StreamJob();
       job.setConf(conf);
       int exitCode = job.run(genArgs());
-      assertEquals("Job failed", 0, exitCode);
+      assertEquals(0, exitCode, "Job failed");
       outFile = new File(OUTPUT_DIR, outFileName).getAbsoluteFile();
       String output = StreamUtil.slurp(outFile);
-      assertEquals("Output was truncated", EXPECTED_OUTPUT_SIZE,
-          StringUtils.countMatches(output, "\t"));
+      assertEquals(EXPECTED_OUTPUT_SIZE, StringUtils.countMatches(output, 
"\t"),
+          "Output was truncated");
     } finally {
       INPUT_FILE.delete();
       FileUtil.fullyDelete(OUTPUT_DIR.getAbsoluteFile());
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/io/TestKeyOnlyTextOutputReader.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/io/TestKeyOnlyTextOutputReader.java
index d606fe106c2..0ebfa0ffd3c 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/io/TestKeyOnlyTextOutputReader.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/io/TestKeyOnlyTextOutputReader.java
@@ -18,18 +18,18 @@
 
 package org.apache.hadoop.streaming.io;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import java.io.ByteArrayInputStream;
 import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.junit.Assert;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.streaming.PipeMapRed;
 import org.apache.hadoop.streaming.PipeMapper;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestKeyOnlyTextOutputReader {
   @Test
@@ -39,12 +39,12 @@ public void testKeyOnlyTextOutputReader() throws 
IOException {
     KeyOnlyTextOutputReader outputReader = new KeyOnlyTextOutputReader();
     outputReader.initialize(pipeMapRed);
     outputReader.readKeyValue();
-    Assert.assertEquals(new Text("key,value"), outputReader.getCurrentKey());
+    assertEquals(new Text("key,value"), outputReader.getCurrentKey());
     outputReader.readKeyValue();
-    Assert.assertEquals(new Text("key2,value2"), outputReader.getCurrentKey());
+    assertEquals(new Text("key2,value2"), outputReader.getCurrentKey());
     outputReader.readKeyValue();
-    Assert.assertEquals(new Text("nocomma"), outputReader.getCurrentKey());
-    Assert.assertEquals(false, outputReader.readKeyValue());
+    assertEquals(new Text("nocomma"), outputReader.getCurrentKey());
+    assertEquals(false, outputReader.readKeyValue());
   }
   
   private class MyPipeMapRed extends PipeMapper {
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/mapreduce/TestStreamXmlRecordReader.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/mapreduce/TestStreamXmlRecordReader.java
index 270a1f7fd91..5ef41b1cc00 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/mapreduce/TestStreamXmlRecordReader.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/streaming/mapreduce/TestStreamXmlRecordReader.java
@@ -18,8 +18,8 @@
 
 package org.apache.hadoop.streaming.mapreduce;
 
-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.io.File;
 import java.io.FileOutputStream;
@@ -38,9 +38,9 @@
 import org.apache.hadoop.mapreduce.Mapper;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
-import org.junit.After;
-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;
 
 /**
  * This class tests StreamXmlRecordReader The test creates an XML file, uses
@@ -96,7 +96,7 @@ private String slurpHadoop(Path p, FileSystem fs) throws 
IOException {
     return contents;
   }
 
-  @Before
+  @BeforeEach
   public void createInput() throws IOException {
     FileOutputStream out = new FileOutputStream(INPUT_FILE.getAbsoluteFile());
     String dummyXmlStartTag = "<PATTERN>\n";
@@ -137,7 +137,7 @@ public void testStreamXmlRecordReader() throws Exception {
 
   }
 
-  @After
+  @AfterEach
   public void tearDown() throws IOException {
     fs.delete(OUTPUT_DIR, true);
   }
diff --git 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/typedbytes/TestTypedBytesWritable.java
 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/typedbytes/TestTypedBytesWritable.java
index 1ca543610f6..d130b6021cd 100644
--- 
a/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/typedbytes/TestTypedBytesWritable.java
+++ 
b/hadoop-tools/hadoop-streaming/src/test/java/org/apache/hadoop/typedbytes/TestTypedBytesWritable.java
@@ -26,8 +26,8 @@
 import java.io.DataOutputStream;
 import java.io.IOException;
 
-import org.junit.Test;
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class TestTypedBytesWritable {
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org


Reply via email to