You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@orc.apache.org by do...@apache.org on 2021/08/03 08:05:25 UTC

[orc] branch branch-1.7 updated: ORC-901: Remove junit-vintage-engine from `mapreduce/tools` module (#807)

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

dongjoon pushed a commit to branch branch-1.7
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new 0a30ce0  ORC-901: Remove junit-vintage-engine from `mapreduce/tools` module (#807)
0a30ce0 is described below

commit 0a30ce0f95f90f62d1488ebba754341b7d330586
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Mon Aug 2 22:50:54 2021 -0700

    ORC-901: Remove junit-vintage-engine from `mapreduce/tools` module (#807)
    
    ### What changes were proposed in this pull request?
    
    This PR aims to remove old dependencies from `mapreduce` and `tools` modules by removing `junit-vintage-engine`.
    - `junit-jupiter-api` is added.
    - `junit-jupiter-params` is added to replace the JUnit4's parameterized test class.
    - Remove unused `objenesis` and `net.bytebuddy` from `mapreduce` module.
    
    ### Why are the changes needed?
    
    This will complete the JUnit5 migration in these modules.
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    (cherry picked from commit 29cf284cc333609f9ca68dcc3e7eda44cc3e08f9)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 java/mapreduce/pom.xml                             |  16 +-
 .../apache/orc/mapred/TestOrcFileEvolution.java    | 191 ++++++++++-----------
 .../test/org/apache/orc/mapred/TestOrcList.java    |   6 +-
 .../src/test/org/apache/orc/mapred/TestOrcMap.java |   6 +-
 .../org/apache/orc/mapred/TestOrcOutputFormat.java |  10 +-
 .../test/org/apache/orc/mapred/TestOrcStruct.java  |  20 +--
 .../org/apache/orc/mapred/TestOrcTimestamp.java    |   7 +-
 .../test/org/apache/orc/mapred/TestOrcUnion.java   |   6 +-
 .../mapreduce/TestMapreduceOrcOutputFormat.java    |   6 +-
 java/pom.xml                                       |  12 ++
 java/tools/pom.xml                                 |   7 +-
 .../org/apache/orc/impl/TestHadoopKeyProvider.java |   4 +-
 .../src/test/org/apache/orc/impl/TestRLEv2.java    |  19 +-
 .../test/org/apache/orc/tools/TestFileDump.java    |   9 +-
 .../org/apache/orc/tools/TestJsonFileDump.java     |   8 +-
 .../apache/orc/tools/convert/TestCsvReader.java    |  27 ++-
 .../apache/orc/tools/convert/TestJsonReader.java   |   6 +-
 .../orc/tools/json/TestJsonSchemaFinder.java       |   4 +-
 18 files changed, 171 insertions(+), 193 deletions(-)

diff --git a/java/mapreduce/pom.xml b/java/mapreduce/pom.xml
index e17b8d3..53ffec0 100644
--- a/java/mapreduce/pom.xml
+++ b/java/mapreduce/pom.xml
@@ -71,12 +71,12 @@
     <!-- test inter-project -->
     <dependency>
       <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-engine</artifactId>
+      <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -84,16 +84,6 @@
       <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.objenesis</groupId>
-      <artifactId>objenesis</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.bytebuddy</groupId>
-      <artifactId>byte-buddy</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcFileEvolution.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcFileEvolution.java
index ddae9fe..11eccbe 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcFileEvolution.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcFileEvolution.java
@@ -30,25 +30,20 @@ import org.apache.hadoop.mapred.Reporter;
 import org.apache.orc.*;
 import org.apache.orc.TypeDescription.Category;
 import org.apache.orc.impl.SchemaEvolution;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
 
-import static org.junit.Assert.*;
+import org.junit.jupiter.api.*;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import static org.junit.jupiter.api.Assertions.*;
 import static org.mockito.Mockito.mock;
 
 /**
  * Test the behavior of ORC's schema evolution
  */
-@RunWith(Parameterized.class)
 public class TestOrcFileEvolution {
 
   // These utility methods are just to make writing tests easier. The values
@@ -82,37 +77,18 @@ public class TestOrcFileEvolution {
   FileSystem fs;
   Path testFilePath;
 
-  private boolean addSarg;
-
-  public TestOrcFileEvolution(boolean addSarg) {
-    this.addSarg = addSarg;
-  }
-
-  @Parameterized.Parameters
-  public static Collection params() {
-    return Arrays.asList(new Object[][] {
-      { true },
-      { false }
-    });
-  }
-
-  @Rule
-  public TestName testCaseName = new TestName();
-
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
-  @Before
-  public void openFileSystem() throws Exception {
+  @BeforeEach
+  public void openFileSystem(TestInfo testInfo) throws Exception {
     conf = new Configuration();
     fs = FileSystem.getLocal(conf);
     testFilePath = new Path(workDir, "TestOrcFile." +
-        testCaseName.getMethodName() + ".orc");
+        testInfo.getTestMethod().get().getName() + ".orc");
     fs.delete(testFilePath, false);
   }
 
-  @Test
-  public void testAddFieldToEnd() {
+  @ParameterizedTest
+  @ValueSource(booleans =  {true, false})
+  public void testAddFieldToEnd(boolean addSarg) {
     checkEvolution("struct<a:int,b:string>", "struct<a:int,b:string,c:double>",
         struct(11, "foo"),
         addSarg ? struct(0, "", 0.0) : struct(11, "foo", null),
@@ -134,70 +110,79 @@ public class TestOrcFileEvolution {
                    sArg, sCols, false);
   }
 
-  @Test
-  public void testAddFieldBeforeEnd() {
+  @ParameterizedTest
+  @ValueSource(booleans =  {true, false})
+  public void testAddFieldBeforeEnd(boolean addSarg) {
     checkEvolution("struct<a:int,b:string>", "struct<a:int,c:double,b:string>",
         struct(1, "foo"),
         struct(1, null, "foo"),
                    addSarg);
   }
 
-  @Test
-  public void testRemoveLastField() {
+  @ParameterizedTest
+  @ValueSource(booleans =  {true, false})
+  public void testRemoveLastField(boolean addSarg) {
     checkEvolution("struct<a:int,b:string,c:double>", "struct<a:int,b:string>",
         struct(1, "foo", 3.14),
         struct(1, "foo"),
                    addSarg);
   }
 
-  @Test
-  public void testRemoveFieldBeforeEnd() {
+  @ParameterizedTest
+  @ValueSource(booleans =  {true, false})
+  public void testRemoveFieldBeforeEnd(boolean addSarg) {
     checkEvolution("struct<a:int,b:string,c:double>", "struct<a:int,c:double>",
         struct(1, "foo", 3.14),
         struct(1, 3.14),
                    addSarg);
   }
 
-  @Test
-  public void testRemoveAndAddField() {
+  @ParameterizedTest
+  @ValueSource(booleans =  {true, false})
+  public void testRemoveAndAddField(boolean addSarg) {
     checkEvolution("struct<a:int,b:string>", "struct<a:int,c:double>",
         struct(1, "foo"), struct(1, null),
                    addSarg);
   }
 
-  @Test
-  public void testReorderFields() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testReorderFields(boolean addSarg) {
     checkEvolution("struct<a:int,b:string>", "struct<b:string,a:int>",
         struct(1, "foo"), struct("foo", 1),
                    addSarg);
   }
 
-  @Test
-  public void testAddFieldEndOfStruct() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testAddFieldEndOfStruct(boolean addSarg) {
     checkEvolution("struct<a:struct<b:int>,c:string>",
         "struct<a:struct<b:int,d:double>,c:string>",
         struct(struct(2), "foo"), struct(struct(2, null), "foo"),
                    addSarg);
   }
 
-  @Test
-  public void testAddFieldBeforeEndOfStruct() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testAddFieldBeforeEndOfStruct(boolean addSarg) {
     checkEvolution("struct<a:struct<b:int>,c:string>",
         "struct<a:struct<d:double,b:int>,c:string>",
         struct(struct(2), "foo"), struct(struct(null, 2), "foo"),
                    addSarg);
   }
 
-  @Test
-  public void testAddSimilarField() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testAddSimilarField(boolean addSarg) {
     checkEvolution("struct<a:struct<b:int>>",
         "struct<a:struct<b:int>,c:struct<b:int>>", struct(struct(2)),
         struct(struct(2), null),
                    addSarg);
   }
 
-  @Test
-  public void testConvergentEvolution() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testConvergentEvolution(boolean addSarg) {
     checkEvolution("struct<a:struct<a:int,b:string>,c:struct<a:int>>",
         "struct<a:struct<a:int,b:string>,c:struct<a:int,b:string>>",
         struct(struct(2, "foo"), struct(3)),
@@ -205,8 +190,9 @@ public class TestOrcFileEvolution {
                    addSarg);
   }
 
-  @Test
-  public void testMapKeyEvolution() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testMapKeyEvolution(boolean addSarg) {
     checkEvolution("struct<a:map<struct<a:int>,int>>",
         "struct<a:map<struct<a:int,b:string>,int>>",
         struct(map(struct(1), 2)),
@@ -214,8 +200,9 @@ public class TestOrcFileEvolution {
                    addSarg);
   }
 
-  @Test
-  public void testMapValueEvolution() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testMapValueEvolution(boolean addSarg) {
     checkEvolution("struct<a:map<int,struct<a:int>>>",
         "struct<a:map<int,struct<a:int,b:string>>>",
         struct(map(2, struct(1))),
@@ -223,8 +210,9 @@ public class TestOrcFileEvolution {
                    addSarg);
   }
 
-  @Test
-  public void testListEvolution() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testListEvolution(boolean addSarg) {
     checkEvolution("struct<a:array<struct<b:int>>>",
         "struct<a:array<struct<b:int,c:string>>>",
         struct(list(struct(1), struct(2))),
@@ -236,17 +224,18 @@ public class TestOrcFileEvolution {
   public void testMissingColumnFromReaderSchema() {
     // Expect failure if the column is missing from the reader schema, as column a that is added
     // by the SArg is missing from the reader schema
-    assertThrows("Field a not found in", IllegalArgumentException.class,
-                        () -> checkEvolution("struct<b:int,c:string>",
-                                       "struct<b:int,c:string>",
-                                       struct(1, "foo"),
-                                       struct(1, "foo", null),
-                                       true, true, false));
-
-  }
-
-  @Test
-  public void testPreHive4243CheckEqual() {
+    assertThrows(IllegalArgumentException.class, () -> {
+      checkEvolution("struct<b:int,c:string>",
+                      "struct<b:int,c:string>",
+                      struct(1, "foo"),
+                      struct(1, "foo", null),
+                      true, true, false);
+    }, "Field a not found in");
+  }
+
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPreHive4243CheckEqual(boolean addSarg) {
     // Expect success on equal schemas
     checkEvolutionPosn("struct<_col0:int,_col1:string>",
                    "struct<_col0:int,_col1:string>",
@@ -254,36 +243,43 @@ public class TestOrcFileEvolution {
                    struct(1, "foo", null), false, addSarg, false);
   }
 
-  @Test
-  public void testPreHive4243Check() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPreHive4243Check(boolean addSarg) {
     // Expect exception on strict compatibility check
-    thrown.expectMessage("HIVE-4243");
-    checkEvolutionPosn("struct<_col0:int,_col1:string>",
-                   "struct<_col0:int,_col1:string,_col2:double>",
-                   struct(1, "foo"),
-                   struct(1, "foo", null), false, addSarg, false);
+    Exception e = assertThrows(RuntimeException.class, () -> {
+      checkEvolutionPosn("struct<_col0:int,_col1:string>",
+        "struct<_col0:int,_col1:string,_col2:double>",
+        struct(1, "foo"),
+        struct(1, "foo", null), false, addSarg, false);
+    });
+    assertTrue(e.getMessage().contains("HIVE-4243"));
   }
 
-  @Test
-  public void testPreHive4243AddColumn() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPreHive4243AddColumn(boolean addSarg) {
     checkEvolutionPosn("struct<_col0:int,_col1:string>",
                    "struct<_col0:int,_col1:string,_col2:double>",
                    struct(1, "foo"),
                    struct(1, "foo", null), true, addSarg, false);
   }
 
-  @Test
-  public void testPreHive4243AddColumnMiddle() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPreHive4243AddColumnMiddle(boolean addSarg) {
     // Expect exception on type mismatch
-    thrown.expect(SchemaEvolution.IllegalEvolutionException.class);
-    checkEvolutionPosn("struct<_col0:int,_col1:double>",
-                   "struct<_col0:int,_col1:date,_col2:double>",
-                   struct(1, 1.0),
-                   null, true, addSarg, false);
+    assertThrows(SchemaEvolution.IllegalEvolutionException.class, () -> {
+      checkEvolutionPosn("struct<_col0:int,_col1:double>",
+        "struct<_col0:int,_col1:date,_col2:double>",
+        struct(1, 1.0),
+        null, true, addSarg, false);
+    });
   }
 
-  @Test
-  public void testPreHive4243AddColumnWithFix() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPreHive4243AddColumnWithFix(boolean addSarg) {
     checkEvolution("struct<_col0:int,_col1:string>",
                    "struct<a:int,b:string,c:double>",
                    struct(1, "foo"),
@@ -293,19 +289,21 @@ public class TestOrcFileEvolution {
   @Test
   public void testPreHive4243AddColumnMiddleWithFix() {
     // Expect exception on type mismatch
-    thrown.expect(SchemaEvolution.IllegalEvolutionException.class);
-    checkEvolution("struct<_col0:int,_col1:double>",
-        "struct<a:int,b:date,c:double>",
-        struct(1, 1.0),
-        null, true);
+    assertThrows(SchemaEvolution.IllegalEvolutionException.class, () -> {
+      checkEvolution("struct<_col0:int,_col1:double>",
+              "struct<a:int,b:date,c:double>",
+              struct(1, 1.0),
+              null, true);
+    });
   }
 
   /**
    * Test positional schema evolution.
    * With the sarg, it eliminates the row and we don't get the row.
    */
-  @Test
-  public void testPositional() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPositional(boolean addSarg) {
     checkEvolution("struct<x:int,y:int,z:int>", "struct<a:int,b:int,c:int,d:int>",
         struct(11, 2, 3),
         // if the sarg works, we get the default value
@@ -317,8 +315,9 @@ public class TestOrcFileEvolution {
    * Make the sarg try to use a column past the end of the file schema, since
    * it will get null, the predicate doesn't hit.
    */
-  @Test
-  public void testPositional2() {
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  public void testPositional2(boolean addSarg) {
     checkEvolution("struct<x:int,y:int,z:int>", "struct<b:int,c:int,d:int,a:int>",
         struct(11, 2, 3),
         struct(11, 2, 3, null),
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcList.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcList.java
index b0cdfb7..4fb0a3b 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcList.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcList.java
@@ -24,12 +24,12 @@ import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.io.Writable;
 import org.apache.orc.TypeDescription;
-import org.junit.Test;
 
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestOrcList {
 
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcMap.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcMap.java
index d34b72e..ff5ae37 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcMap.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcMap.java
@@ -22,12 +22,12 @@ import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.orc.TypeDescription;
-import org.junit.Test;
 
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestOrcMap {
 
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcOutputFormat.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcOutputFormat.java
index f570c37..6345ed8 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcOutputFormat.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcOutputFormat.java
@@ -49,13 +49,13 @@ import org.apache.orc.OrcFile;
 import org.apache.orc.Reader;
 import org.apache.orc.TypeDescription;
 import org.apache.orc.Writer;
-import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestOrcOutputFormat {
 
@@ -187,9 +187,9 @@ public class TestOrcOutputFormat {
         } else {
           union.set((byte) 0, new OrcTimestamp("2011-12-25 12:34:56"));
         }
-        assertEquals("row " + r, struct, row.getFieldValue(11));
-        assertEquals("row " + r, new OrcTimestamp("1996-12-11 15:00:00"),
-            row.getFieldValue(12));
+        assertEquals(struct, row.getFieldValue(11), "row " + r);
+        assertEquals(new OrcTimestamp("1996-12-11 15:00:00"),
+            row.getFieldValue(12), "row " + r);
       }
     }
     assertEquals(false, reader.next(nada, row));
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcStruct.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcStruct.java
index f4ee237..9f17b27 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcStruct.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcStruct.java
@@ -34,21 +34,15 @@ import org.apache.orc.OrcFile;
 import org.apache.orc.Reader;
 import org.apache.orc.TypeDescription;
 import org.apache.orc.Writer;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
 
 import com.google.common.io.Files;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import org.junit.jupiter.api.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 
 public class TestOrcStruct {
 
-  @Rule
-  public ExpectedException thrown = ExpectedException.none();
-
   @Test
   public void testRead() throws IOException {
     TypeDescription type =
@@ -167,16 +161,18 @@ public class TestOrcStruct {
   public void testBadFieldRead() {
     OrcStruct struct = new OrcStruct(TypeDescription.fromString
         ("struct<i:int,j:double,k:string>"));
-    thrown.expect(IllegalArgumentException.class);
-    struct.getFieldValue("bad");
+    assertThrows(IllegalArgumentException.class, () -> {
+      struct.getFieldValue("bad");
+    });
   }
 
   @Test
   public void testBadFieldWrite() {
     OrcStruct struct = new OrcStruct(TypeDescription.fromString
         ("struct<i:int,j:double,k:string>"));
-    thrown.expect(IllegalArgumentException.class);
-    struct.setFieldValue("bad", new Text("foobar"));
+    assertThrows(IllegalArgumentException.class, () -> {
+      struct.setFieldValue("bad", new Text("foobar"));
+    });
   }
 
   @Test
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcTimestamp.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcTimestamp.java
index 7feeb15..fe35904 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcTimestamp.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcTimestamp.java
@@ -18,12 +18,11 @@
 
 package org.apache.orc.mapred;
 
-import org.junit.Test;
-
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestOrcTimestamp {
 
diff --git a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcUnion.java b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcUnion.java
index 7c8d523..c02b8e4 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcUnion.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapred/TestOrcUnion.java
@@ -22,12 +22,12 @@ import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
 import org.apache.orc.TypeDescription;
-import org.junit.Test;
 
 import java.io.IOException;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestOrcUnion {
 
diff --git a/java/mapreduce/src/test/org/apache/orc/mapreduce/TestMapreduceOrcOutputFormat.java b/java/mapreduce/src/test/org/apache/orc/mapreduce/TestMapreduceOrcOutputFormat.java
index 547aec2..ab6f71c 100644
--- a/java/mapreduce/src/test/org/apache/orc/mapreduce/TestMapreduceOrcOutputFormat.java
+++ b/java/mapreduce/src/test/org/apache/orc/mapreduce/TestMapreduceOrcOutputFormat.java
@@ -44,13 +44,13 @@ import org.apache.orc.Writer;
 import org.apache.orc.mapred.OrcKey;
 import org.apache.orc.mapred.OrcStruct;
 import org.apache.orc.mapred.OrcValue;
-import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
 
-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 org.junit.jupiter.api.Test;
 
 public class TestMapreduceOrcOutputFormat {
 
diff --git a/java/pom.xml b/java/pom.xml
index 4adb78f..937ee74 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -769,11 +769,23 @@
       </dependency>
       <dependency>
         <groupId>org.junit.jupiter</groupId>
+        <artifactId>junit-jupiter-api</artifactId>
+        <version>5.7.0</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.junit.jupiter</groupId>
         <artifactId>junit-jupiter-engine</artifactId>
         <version>5.7.0</version>
         <scope>test</scope>
       </dependency>
       <dependency>
+        <groupId>org.junit.jupiter</groupId>
+        <artifactId>junit-jupiter-params</artifactId>
+        <version>5.7.0</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
         <groupId>org.junit.vintage</groupId>
         <artifactId>junit-vintage-engine</artifactId>
         <version>5.7.0</version>
diff --git a/java/tools/pom.xml b/java/tools/pom.xml
index 726658c..4ab83eb 100644
--- a/java/tools/pom.xml
+++ b/java/tools/pom.xml
@@ -88,12 +88,7 @@
     <!-- test inter-project -->
     <dependency>
       <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
+      <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
   </dependencies>
diff --git a/java/tools/src/test/org/apache/orc/impl/TestHadoopKeyProvider.java b/java/tools/src/test/org/apache/orc/impl/TestHadoopKeyProvider.java
index 00b67d6..d4e511b 100644
--- a/java/tools/src/test/org/apache/orc/impl/TestHadoopKeyProvider.java
+++ b/java/tools/src/test/org/apache/orc/impl/TestHadoopKeyProvider.java
@@ -19,14 +19,14 @@ package org.apache.orc.impl;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.BytesWritable;
-import org.junit.Test;
 
 import java.io.IOException;
 import java.security.Key;
 import java.util.List;
 import java.util.Random;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestHadoopKeyProvider {
 
diff --git a/java/tools/src/test/org/apache/orc/impl/TestRLEv2.java b/java/tools/src/test/org/apache/orc/impl/TestRLEv2.java
index 39b0213..bd8d9b7 100644
--- a/java/tools/src/test/org/apache/orc/impl/TestRLEv2.java
+++ b/java/tools/src/test/org/apache/orc/impl/TestRLEv2.java
@@ -17,8 +17,8 @@
  */
 package org.apache.orc.impl;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.*;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -43,10 +43,6 @@ import org.apache.orc.TypeDescription;
 import org.apache.orc.Writer;
 import org.apache.orc.impl.writer.StreamOptions;
 import org.apache.orc.tools.FileDump;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
 
 public class TestRLEv2 {
   Path workDir = new Path(System.getProperty("test.tmp.dir",
@@ -55,15 +51,12 @@ public class TestRLEv2 {
   Configuration conf;
   FileSystem fs;
 
-  @Rule
-  public TestName testCaseName = new TestName();
-
-  @Before
-  public void openFileSystem () throws Exception {
+  @BeforeEach
+  public void openFileSystem (TestInfo testInfo) throws Exception {
     conf = new Configuration();
     fs = FileSystem.getLocal(conf);
     testFilePath = new Path(workDir, "TestRLEv2." +
-        testCaseName.getMethodName() + ".orc");
+        testInfo.getTestMethod().get().getName() + ".orc");
     fs.delete(testFilePath, false);
   }
 
@@ -375,7 +368,7 @@ public class TestRLEv2 {
     public void compareBytes(int... expected) {
       for(int i=0; i < expected.length; ++i) {
         ByteBuffer current = getCurrentBuffer();
-        assertEquals("position " + i, (byte) expected[i], current.get());
+        assertEquals((byte) expected[i], current.get(), "position " + i);
       }
       assertEquals(null, getCurrentBuffer());
     }
diff --git a/java/tools/src/test/org/apache/orc/tools/TestFileDump.java b/java/tools/src/test/org/apache/orc/tools/TestFileDump.java
index d1bb469..ca2a0d9 100644
--- a/java/tools/src/test/org/apache/orc/tools/TestFileDump.java
+++ b/java/tools/src/test/org/apache/orc/tools/TestFileDump.java
@@ -18,8 +18,9 @@
 
 package org.apache.orc.tools;
 
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assumptions.*;
+import org.junit.jupiter.api.*;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
@@ -59,8 +60,6 @@ import org.apache.orc.Reader;
 import org.apache.orc.StripeStatistics;
 import org.apache.orc.TypeDescription;
 import org.apache.orc.Writer;
-import org.junit.Before;
-import org.junit.Test;
 
 public class TestFileDump {
 
@@ -69,7 +68,7 @@ public class TestFileDump {
   FileSystem fs;
   Path testFilePath;
 
-  @Before
+  @BeforeEach
   public void openFileSystem () throws Exception {
     conf = new Configuration();
     fs = FileSystem.getLocal(conf);
diff --git a/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java b/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
index 0403a3b..58bfe8f 100644
--- a/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
+++ b/java/tools/src/test/org/apache/orc/tools/TestJsonFileDump.java
@@ -18,8 +18,8 @@
 
 package org.apache.orc.tools;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.*;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -41,8 +41,6 @@ import org.apache.orc.OrcConf;
 import org.apache.orc.OrcFile;
 import org.apache.orc.TypeDescription;
 import org.apache.orc.Writer;
-import org.junit.Before;
-import org.junit.Test;
 
 public class TestJsonFileDump {
 
@@ -59,7 +57,7 @@ public class TestJsonFileDump {
   FileSystem fs;
   Path testFilePath;
 
-  @Before
+  @BeforeEach
   public void openFileSystem () throws Exception {
     conf = new Configuration();
     fs = FileSystem.getLocal(conf);
diff --git a/java/tools/src/test/org/apache/orc/tools/convert/TestCsvReader.java b/java/tools/src/test/org/apache/orc/tools/convert/TestCsvReader.java
index 06ed5d2..0b4609c 100644
--- a/java/tools/src/test/org/apache/orc/tools/convert/TestCsvReader.java
+++ b/java/tools/src/test/org/apache/orc/tools/convert/TestCsvReader.java
@@ -27,27 +27,26 @@ import org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector;
 import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
 import org.apache.orc.RecordReader;
 import org.apache.orc.TypeDescription;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
 
 import java.io.StringReader;
 import java.util.Locale;
 
 import static org.apache.orc.tools.convert.ConvertTool.DEFAULT_TIMESTAMP_FORMAT;
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.*;
 
 public class TestCsvReader {
 
   Locale defaultLocale;
 
-  @Before
+  @BeforeEach
   public void storeDefaultLocale() {
     defaultLocale = Locale.getDefault();
     Locale.setDefault(Locale.US);
   }
 
-  @After
+  @AfterEach
   public void restoreDefaultLocale() {
     Locale.setDefault(defaultLocale);
   }
@@ -111,7 +110,7 @@ public class TestCsvReader {
     assertEquals(true, reader.nextBatch(batch));
     assertEquals(3, batch.size);
     for(int c=0; c < 4; ++c) {
-      assertEquals("column " + c, false, batch.cols[c].noNulls);
+      assertEquals(false, batch.cols[c].noNulls, "column " + c);
     }
 
     // check row 0
@@ -120,12 +119,12 @@ public class TestCsvReader {
     assertEquals("1", ((DecimalColumnVector) batch.cols[2]).vector[0].toString());
     assertEquals("a", ((BytesColumnVector) batch.cols[3]).toString(0));
     for(int c=0; c < 4; ++c) {
-      assertEquals("column " + c, false, batch.cols[c].isNull[0]);
+      assertEquals(false, batch.cols[c].isNull[0], "column " + c);
     }
 
     // row 1
     for(int c=0; c < 4; ++c) {
-      assertEquals("column " + c, true, batch.cols[c].isNull[1]);
+      assertEquals(true, batch.cols[c].isNull[1], "column " + c);
     }
 
     // check row 2
@@ -134,7 +133,7 @@ public class TestCsvReader {
     assertEquals("3", ((DecimalColumnVector) batch.cols[2]).vector[2].toString());
     assertEquals("row 3", ((BytesColumnVector) batch.cols[3]).toString(2));
     for(int c=0; c < 4; ++c) {
-      assertEquals("column " + c, false, batch.cols[c].isNull[2]);
+      assertEquals(false, batch.cols[c].isNull[2], "column " + c);
     }
   }
 
@@ -153,11 +152,11 @@ public class TestCsvReader {
     assertEquals(2, batch.size);
     int nextVal = 1;
     for(int r=0; r < 2; ++r) {
-      assertEquals("row " + r, nextVal++, ((LongColumnVector) batch.cols[0]).vector[r]);
+      assertEquals(nextVal++, ((LongColumnVector) batch.cols[0]).vector[r], "row " + r);
       StructColumnVector b = (StructColumnVector) batch.cols[1];
-      assertEquals("row " + r, nextVal++, ((LongColumnVector) b.fields[0]).vector[r]);
-      assertEquals("row " + r, nextVal++, ((LongColumnVector) b.fields[1]).vector[r]);
-      assertEquals("row " + r, nextVal++, ((LongColumnVector) batch.cols[2]).vector[r]);
+      assertEquals(nextVal++, ((LongColumnVector) b.fields[0]).vector[r], "row " + r);
+      assertEquals(nextVal++, ((LongColumnVector) b.fields[1]).vector[r], "row " + r);
+      assertEquals(nextVal++, ((LongColumnVector) batch.cols[2]).vector[r], "row " + r);
     }
     assertEquals(false, reader.nextBatch(batch));
   }
diff --git a/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java b/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
index 95ca355..fffe3cb 100644
--- a/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
+++ b/java/tools/src/test/org/apache/orc/tools/convert/TestJsonReader.java
@@ -22,7 +22,6 @@ import org.apache.hadoop.hive.ql.exec.vector.DateColumnVector;
 import org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector;
 import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
 import org.apache.orc.TypeDescription;
-import org.junit.Test;
 
 import java.io.IOException;
 import java.io.StringReader;
@@ -33,9 +32,8 @@ import java.time.ZonedDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 
-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.*;
+import org.junit.jupiter.api.Test;
 
 public class TestJsonReader {
     @Test
diff --git a/java/tools/src/test/org/apache/orc/tools/json/TestJsonSchemaFinder.java b/java/tools/src/test/org/apache/orc/tools/json/TestJsonSchemaFinder.java
index e125888..4846bc2 100644
--- a/java/tools/src/test/org/apache/orc/tools/json/TestJsonSchemaFinder.java
+++ b/java/tools/src/test/org/apache/orc/tools/json/TestJsonSchemaFinder.java
@@ -23,9 +23,9 @@ import com.google.gson.JsonNull;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonPrimitive;
 import com.google.gson.internal.LazilyParsedNumber;
-import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
 
 public class TestJsonSchemaFinder {