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

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


The following commit(s) were added to refs/heads/main by this push:
     new 23e1f4c2db GH-42025: [Java] Update Unit Tests for Algorithm Module 
(#42029)
23e1f4c2db is described below

commit 23e1f4c2db3501173d1e9b3a77bdc36b4c7b5bf4
Author: Hyunseok Seo <[email protected]>
AuthorDate: Wed Jun 12 14:19:33 2024 +0900

    GH-42025: [Java] Update Unit Tests for Algorithm Module (#42029)
    
    
    
    ### Rationale for this change
    
    Update package from JUnit 4(`org.junit`) to JUnit 5(`org.junit.jupiter`).
    
    ### What changes are included in this PR?
    
    - [x] Replacing `org.junit` and `junit.framework.TestCase` with 
`org.junit.jupiter.api`.
    - [x] Updating `Assertions.assertXXX` to `assertXXX` using static imports.
    - [x] Updating annotations such as `@ Before`, `@ After`.
      - `@ Before` -> `@ BeforeEach`
      - `@ After` -> `@ AfterEach`
      - `@ Test` -> `@ Test` with `org.junit.jupiter`
    - [x] Updating `Parameterized` test
    - [x] Doing self review round 1
    - [x] Resolving conflcit
    - [x] Doing self review rount 2
    
    ### Are these changes tested?
    
    Yes, existing tests have passed.
    
    ### Are there any user-facing changes?
    
    No.
    
    * GitHub Issue: #42025
    
    Authored-by: Hyunseok Seo <[email protected]>
    Signed-off-by: David Li <[email protected]>
---
 .../deduplicate/TestDeduplicationUtils.java        |  12 +-
 .../deduplicate/TestVectorRunDeduplicator.java     |  12 +-
 .../TestHashTableBasedDictionaryBuilder.java       |  14 +-
 .../dictionary/TestHashTableDictionaryEncoder.java |  12 +-
 .../dictionary/TestLinearDictionaryEncoder.java    |  19 ++-
 .../dictionary/TestSearchDictionaryEncoder.java    |  19 ++-
 .../TestSearchTreeBasedDictionaryBuilder.java      |  14 +-
 .../arrow/algorithm/misc/TestPartialSumUtils.java  |  12 +-
 .../arrow/algorithm/rank/TestVectorRank.java       |  12 +-
 .../algorithm/search/TestParallelSearcher.java     |  54 +++----
 .../algorithm/search/TestVectorRangeSearcher.java  |  51 +++---
 .../arrow/algorithm/search/TestVectorSearcher.java |  12 +-
 .../sort/TestCompositeVectorComparator.java        |  10 +-
 .../sort/TestDefaultVectorComparator.java          |  17 +-
 .../sort/TestFixedWidthInPlaceVectorSorter.java    |  37 +++--
 .../sort/TestFixedWidthOutOfPlaceVectorSorter.java | 178 +++++++++++----------
 .../algorithm/sort/TestFixedWidthSorting.java      | 168 +++++++++----------
 .../sort/TestGeneralOutOfPlaceVectorSorter.java    |  12 +-
 .../arrow/algorithm/sort/TestIndexSorter.java      |  14 +-
 .../arrow/algorithm/sort/TestInsertionSorter.java  |  12 +-
 .../arrow/algorithm/sort/TestOffHeapIntStack.java  |  14 +-
 .../algorithm/sort/TestOutOfPlaceVectorSorter.java |  24 +--
 .../algorithm/sort/TestStableVectorComparator.java |  15 +-
 .../TestVariableWidthOutOfPlaceVectorSorter.java   |  35 ++--
 .../algorithm/sort/TestVariableWidthSorting.java   |  67 +++-----
 25 files changed, 396 insertions(+), 450 deletions(-)

diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestDeduplicationUtils.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestDeduplicationUtils.java
index 537189013a..49a719bafa 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestDeduplicationUtils.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestDeduplicationUtils.java
@@ -16,8 +16,8 @@
  */
 package org.apache.arrow.algorithm.deduplicate;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.charset.StandardCharsets;
 import org.apache.arrow.memory.ArrowBuf;
@@ -27,9 +27,9 @@ import org.apache.arrow.vector.BitVectorHelper;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.util.DataSizeRoundingUtil;
-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;
 
 /** Test cases for {@link DeduplicationUtils}. */
 public class TestDeduplicationUtils {
@@ -40,12 +40,12 @@ public class TestDeduplicationUtils {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestVectorRunDeduplicator.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestVectorRunDeduplicator.java
index 820cadccae..7fd816ee9f 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestVectorRunDeduplicator.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/deduplicate/TestVectorRunDeduplicator.java
@@ -16,17 +16,17 @@
  */
 package org.apache.arrow.algorithm.deduplicate;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.charset.StandardCharsets;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
-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;
 
 /** Test cases for {@link VectorRunDeduplicator}. */
 public class TestVectorRunDeduplicator {
@@ -37,12 +37,12 @@ public class TestVectorRunDeduplicator {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableBasedDictionaryBuilder.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableBasedDictionaryBuilder.java
index bfda86f268..6e438c7ee2 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableBasedDictionaryBuilder.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableBasedDictionaryBuilder.java
@@ -16,9 +16,9 @@
  */
 package org.apache.arrow.algorithm.dictionary;
 
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertNull;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Objects;
@@ -26,21 +26,21 @@ import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
-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;
 
 /** Test cases for {@link HashTableBasedDictionaryBuilder}. */
 public class TestHashTableBasedDictionaryBuilder {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableDictionaryEncoder.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableDictionaryEncoder.java
index b9646284a0..0f5ea463bd 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableDictionaryEncoder.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestHashTableDictionaryEncoder.java
@@ -16,10 +16,10 @@
  */
 package org.apache.arrow.algorithm.dictionary;
 
-import static junit.framework.TestCase.assertTrue;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
@@ -32,9 +32,9 @@ import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.dictionary.Dictionary;
 import org.apache.arrow.vector.dictionary.DictionaryEncoder;
 import org.apache.arrow.vector.types.pojo.DictionaryEncoding;
-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;
 
 /** Test cases for {@link HashTableDictionaryEncoder}. */
 public class TestHashTableDictionaryEncoder {
@@ -51,12 +51,12 @@ public class TestHashTableDictionaryEncoder {
 
   byte[][] data = new byte[][] {zero, one, two};
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestLinearDictionaryEncoder.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestLinearDictionaryEncoder.java
index a464170419..9a8957ddbd 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestLinearDictionaryEncoder.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestLinearDictionaryEncoder.java
@@ -16,10 +16,10 @@
  */
 package org.apache.arrow.algorithm.dictionary;
 
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
@@ -32,10 +32,9 @@ import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.dictionary.Dictionary;
 import org.apache.arrow.vector.dictionary.DictionaryEncoder;
 import org.apache.arrow.vector.types.pojo.DictionaryEncoding;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link LinearDictionaryEncoder}. */
 public class TestLinearDictionaryEncoder {
@@ -52,12 +51,12 @@ public class TestLinearDictionaryEncoder {
 
   byte[][] data = new byte[][] {zero, one, two};
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -350,7 +349,7 @@ public class TestLinearDictionaryEncoder {
         assertEquals(vector.getClass(), decoded.getClass());
         assertEquals(vector.getValueCount(), decoded.getValueCount());
         for (int i = 0; i < 5; i++) {
-          Assert.assertTrue(Arrays.equals(vector.getObject(i), 
decoded.getObject(i)));
+          assertTrue(Arrays.equals(vector.getObject(i), decoded.getObject(i)));
         }
       }
     }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchDictionaryEncoder.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchDictionaryEncoder.java
index e783e1f768..063c740a12 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchDictionaryEncoder.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchDictionaryEncoder.java
@@ -16,10 +16,10 @@
  */
 package org.apache.arrow.algorithm.dictionary;
 
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
@@ -33,10 +33,9 @@ import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.dictionary.Dictionary;
 import org.apache.arrow.vector.dictionary.DictionaryEncoder;
 import org.apache.arrow.vector.types.pojo.DictionaryEncoding;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link SearchDictionaryEncoder}. */
 public class TestSearchDictionaryEncoder {
@@ -53,12 +52,12 @@ public class TestSearchDictionaryEncoder {
 
   byte[][] data = new byte[][] {zero, one, two};
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -357,7 +356,7 @@ public class TestSearchDictionaryEncoder {
         assertEquals(vector.getClass(), decoded.getClass());
         assertEquals(vector.getValueCount(), decoded.getValueCount());
         for (int i = 0; i < 5; i++) {
-          Assert.assertTrue(Arrays.equals(vector.getObject(i), 
decoded.getObject(i)));
+          assertTrue(Arrays.equals(vector.getObject(i), decoded.getObject(i)));
         }
       }
     }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchTreeBasedDictionaryBuilder.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchTreeBasedDictionaryBuilder.java
index 6c8a57c1a4..57e1de9497 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchTreeBasedDictionaryBuilder.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/dictionary/TestSearchTreeBasedDictionaryBuilder.java
@@ -16,8 +16,8 @@
  */
 package org.apache.arrow.algorithm.dictionary;
 
-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.charset.StandardCharsets;
 import java.util.Objects;
@@ -27,21 +27,21 @@ import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
-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;
 
 /** Test cases for {@link SearchTreeBasedDictionaryBuilder}. */
 public class TestSearchTreeBasedDictionaryBuilder {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/misc/TestPartialSumUtils.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/misc/TestPartialSumUtils.java
index e3ab981670..e1b255f4f4 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/misc/TestPartialSumUtils.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/misc/TestPartialSumUtils.java
@@ -16,14 +16,14 @@
  */
 package org.apache.arrow.algorithm.misc;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
-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;
 
 /** Test cases for {@link PartialSumUtils}. */
 public class TestPartialSumUtils {
@@ -34,12 +34,12 @@ public class TestPartialSumUtils {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/rank/TestVectorRank.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/rank/TestVectorRank.java
index 4b7c6a9756..0b70cfd297 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/rank/TestVectorRank.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/rank/TestVectorRank.java
@@ -16,7 +16,7 @@
  */
 package org.apache.arrow.algorithm.rank;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.nio.charset.StandardCharsets;
@@ -26,9 +26,9 @@ import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
-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;
 
 /** Test cases for {@link org.apache.arrow.algorithm.rank.VectorRank}. */
 public class TestVectorRank {
@@ -37,12 +37,12 @@ public class TestVectorRank {
 
   private static final int VECTOR_LENGTH = 10;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestParallelSearcher.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestParallelSearcher.java
index 7ff86a743e..24a9a6ed69 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestParallelSearcher.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestParallelSearcher.java
@@ -20,25 +20,24 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.stream.Stream;
 import org.apache.arrow.algorithm.sort.DefaultVectorComparators;
 import org.apache.arrow.algorithm.sort.VectorValueComparator;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.VarCharVector;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test cases for {@link ParallelSearcher}. */
-@RunWith(Parameterized.class)
 public class TestParallelSearcher {
 
   private enum ComparatorType {
@@ -48,45 +47,39 @@ public class TestParallelSearcher {
 
   private static final int VECTOR_LENGTH = 10000;
 
-  private final int threadCount;
-
   private BufferAllocator allocator;
 
   private ExecutorService threadPool;
 
-  private final ComparatorType comparatorType;
-
-  public TestParallelSearcher(ComparatorType comparatorType, int threadCount) {
-    this.comparatorType = comparatorType;
-    this.threadCount = threadCount;
-  }
-
-  @Parameterized.Parameters(name = "comparator type = {0}, thread count = {1}")
-  public static Collection<Object[]> getComparatorName() {
-    List<Object[]> params = new ArrayList<>();
+  public static Stream<Arguments> getComparatorName() {
+    List<Arguments> params = new ArrayList<>();
     int[] threadCounts = {1, 2, 5, 10, 20, 50};
     for (ComparatorType type : ComparatorType.values()) {
       for (int count : threadCounts) {
-        params.add(new Object[] {type, count});
+        params.add(Arguments.of(type, count));
       }
     }
-    return params;
+    return params.stream();
   }
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
-    threadPool = Executors.newFixedThreadPool(threadCount);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
-    threadPool.shutdown();
+    if (threadPool != null) {
+      threadPool.shutdown();
+    }
   }
 
-  @Test
-  public void testParallelIntSearch() throws ExecutionException, 
InterruptedException {
+  @ParameterizedTest
+  @MethodSource("getComparatorName")
+  public void testParallelIntSearch(ComparatorType comparatorType, int 
threadCount)
+      throws ExecutionException, InterruptedException {
+    threadPool = Executors.newFixedThreadPool(threadCount);
     try (IntVector targetVector = new IntVector("targetVector", allocator);
         IntVector keyVector = new IntVector("keyVector", allocator)) {
       targetVector.allocateNew(VECTOR_LENGTH);
@@ -121,8 +114,11 @@ public class TestParallelSearcher {
     }
   }
 
-  @Test
-  public void testParallelStringSearch() throws ExecutionException, 
InterruptedException {
+  @ParameterizedTest
+  @MethodSource("getComparatorName")
+  public void testParallelStringSearch(ComparatorType comparatorType, int 
threadCount)
+      throws ExecutionException, InterruptedException {
+    threadPool = Executors.newFixedThreadPool(threadCount);
     try (VarCharVector targetVector = new VarCharVector("targetVector", 
allocator);
         VarCharVector keyVector = new VarCharVector("keyVector", allocator)) {
       targetVector.allocateNew(VECTOR_LENGTH);
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorRangeSearcher.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorRangeSearcher.java
index 39f2f609f7..922ec6cbee 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorRangeSearcher.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorRangeSearcher.java
@@ -16,45 +16,38 @@
  */
 package org.apache.arrow.algorithm.search;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import java.util.Arrays;
-import java.util.Collection;
+import java.util.stream.Stream;
 import org.apache.arrow.algorithm.sort.DefaultVectorComparators;
 import org.apache.arrow.algorithm.sort.VectorValueComparator;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test cases for {@link VectorRangeSearcher}. */
-@RunWith(Parameterized.class)
 public class TestVectorRangeSearcher {
 
   private BufferAllocator allocator;
 
-  private int repeat;
-
-  public TestVectorRangeSearcher(int repeat) {
-    this.repeat = repeat;
-  }
-
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  @Test
-  public void testGetLowerBounds() {
+  @ParameterizedTest
+  @MethodSource("getRepeat")
+  public void testGetLowerBounds(int repeat) {
     final int maxValue = 100;
     try (IntVector intVector = new IntVector("int vec", allocator)) {
       // allocate vector
@@ -84,8 +77,9 @@ public class TestVectorRangeSearcher {
     }
   }
 
-  @Test
-  public void testGetLowerBoundsNegative() {
+  @ParameterizedTest
+  @MethodSource("getRepeat")
+  public void testGetLowerBoundsNegative(int repeat) {
     final int maxValue = 100;
     try (IntVector intVector = new IntVector("int vec", allocator);
         IntVector negVector = new IntVector("neg vec", allocator)) {
@@ -119,8 +113,9 @@ public class TestVectorRangeSearcher {
     }
   }
 
-  @Test
-  public void testGetUpperBounds() {
+  @ParameterizedTest
+  @MethodSource("getRepeat")
+  public void testGetUpperBounds(int repeat) {
     final int maxValue = 100;
     try (IntVector intVector = new IntVector("int vec", allocator)) {
       // allocate vector
@@ -149,8 +144,9 @@ public class TestVectorRangeSearcher {
     }
   }
 
-  @Test
-  public void testGetUpperBoundsNegative() {
+  @ParameterizedTest
+  @MethodSource("getRepeat")
+  public void testGetUpperBoundsNegative(int repeat) {
     final int maxValue = 100;
     try (IntVector intVector = new IntVector("int vec", allocator);
         IntVector negVector = new IntVector("neg vec", allocator)) {
@@ -184,8 +180,7 @@ public class TestVectorRangeSearcher {
     }
   }
 
-  @Parameterized.Parameters(name = "repeat = {0}")
-  public static Collection<Object[]> getRepeat() {
-    return Arrays.asList(new Object[] {1}, new Object[] {2}, new Object[] {5}, 
new Object[] {10});
+  public static Stream<Arguments> getRepeat() {
+    return Stream.of(Arguments.of(1), Arguments.of(2), Arguments.of(5), 
Arguments.of(10));
   }
 }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorSearcher.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorSearcher.java
index 629d900b47..f08749a8d1 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorSearcher.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/search/TestVectorSearcher.java
@@ -17,7 +17,7 @@
 package org.apache.arrow.algorithm.search;
 
 import static 
org.apache.arrow.vector.complex.BaseRepeatedValueVector.OFFSET_WIDTH;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.charset.StandardCharsets;
 import org.apache.arrow.algorithm.sort.DefaultVectorComparators;
@@ -31,9 +31,9 @@ import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.complex.ListVector;
 import org.apache.arrow.vector.types.Types;
 import org.apache.arrow.vector.types.pojo.FieldType;
-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;
 
 /** Test cases for {@link org.apache.arrow.algorithm.search.VectorSearcher}. */
 public class TestVectorSearcher {
@@ -42,12 +42,12 @@ public class TestVectorSearcher {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestCompositeVectorComparator.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestCompositeVectorComparator.java
index 21f6c0217c..35f55f3389 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestCompositeVectorComparator.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestCompositeVectorComparator.java
@@ -27,21 +27,21 @@ import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.ValueVector;
 import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.VectorSchemaRoot;
-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;
 
 /** Test cases for {@link CompositeVectorComparator}. */
 public class TestCompositeVectorComparator {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestDefaultVectorComparator.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestDefaultVectorComparator.java
index f1b3d6fb5a..2a046533e8 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestDefaultVectorComparator.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestDefaultVectorComparator.java
@@ -17,7 +17,7 @@
 package org.apache.arrow.algorithm.sort;
 
 import static 
org.apache.arrow.vector.complex.BaseRepeatedValueVector.OFFSET_WIDTH;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
@@ -61,22 +61,21 @@ import org.apache.arrow.vector.types.TimeUnit;
 import org.apache.arrow.vector.types.Types;
 import org.apache.arrow.vector.types.pojo.ArrowType;
 import org.apache.arrow.vector.types.pojo.FieldType;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link DefaultVectorComparators}. */
 public class TestDefaultVectorComparator {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -278,8 +277,8 @@ public class TestDefaultVectorComparator {
       assertTrue(comparator.compare(1, 3) > 0);
       assertTrue(comparator.compare(2, 5) > 0);
       assertTrue(comparator.compare(4, 5) < 0);
-      Assertions.assertEquals(0, comparator.compare(1, 6));
-      Assertions.assertEquals(0, comparator.compare(0, 7));
+      assertEquals(0, comparator.compare(1, 6));
+      assertEquals(0, comparator.compare(0, 7));
       assertTrue(comparator.compare(8, 9) < 0);
       assertTrue(comparator.compare(4, 8) < 0);
       assertTrue(comparator.compare(5, 9) < 0);
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthInPlaceVectorSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthInPlaceVectorSorter.java
index ed5aadfcda..d0f59219a8 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthInPlaceVectorSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthInPlaceVectorSorter.java
@@ -16,31 +16,30 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.stream.IntStream;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link FixedWidthInPlaceVectorSorter}. */
 public class TestFixedWidthInPlaceVectorSorter {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -71,18 +70,18 @@ public class TestFixedWidthInPlaceVectorSorter {
       sorter.sortInPlace(vec, comparator);
 
       // verify results
-      Assert.assertEquals(10, vec.getValueCount());
+      assertEquals(10, vec.getValueCount());
 
       assertTrue(vec.isNull(0));
       assertTrue(vec.isNull(1));
-      Assert.assertEquals(2, vec.get(2));
-      Assert.assertEquals(8, vec.get(3));
-      Assert.assertEquals(10, vec.get(4));
-      Assert.assertEquals(10, vec.get(5));
-      Assert.assertEquals(12, vec.get(6));
-      Assert.assertEquals(17, vec.get(7));
-      Assert.assertEquals(23, vec.get(8));
-      Assert.assertEquals(35, vec.get(9));
+      assertEquals(2, vec.get(2));
+      assertEquals(8, vec.get(3));
+      assertEquals(10, vec.get(4));
+      assertEquals(10, vec.get(5));
+      assertEquals(12, vec.get(6));
+      assertEquals(17, vec.get(7));
+      assertEquals(23, vec.get(8));
+      assertEquals(35, vec.get(9));
     }
   }
 
@@ -110,10 +109,10 @@ public class TestFixedWidthInPlaceVectorSorter {
       sorter.sortInPlace(vec, comparator);
 
       // verify results
-      Assert.assertEquals(vectorLength, vec.getValueCount());
+      assertEquals(vectorLength, vec.getValueCount());
 
       for (int i = 0; i < vectorLength; i++) {
-        Assert.assertEquals(i, vec.get(i));
+        assertEquals(i, vec.get(i));
       }
     }
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthOutOfPlaceVectorSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthOutOfPlaceVectorSorter.java
index 4096897c20..e1e5167831 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthOutOfPlaceVectorSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthOutOfPlaceVectorSorter.java
@@ -16,8 +16,9 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.stream.IntStream;
 import org.apache.arrow.memory.BufferAllocator;
@@ -30,38 +31,35 @@ import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.SmallIntVector;
 import org.apache.arrow.vector.TinyIntVector;
 import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test cases for {@link FixedWidthOutOfPlaceVectorSorter}. */
 public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSorter {
 
   private BufferAllocator allocator;
 
-  public TestFixedWidthOutOfPlaceVectorSorter(boolean generalSorter) {
-    super(generalSorter);
-  }
-
-  <V extends BaseFixedWidthVector> OutOfPlaceVectorSorter<V> getSorter() {
+  <V extends BaseFixedWidthVector> OutOfPlaceVectorSorter<V> getSorter(boolean 
generalSorter) {
     return generalSorter
         ? new GeneralOutOfPlaceVectorSorter<>()
         : new FixedWidthOutOfPlaceVectorSorter<>();
   }
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  @Test
-  public void testSortByte() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortByte(boolean generalSorter) {
     try (TinyIntVector vec = new TinyIntVector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -79,7 +77,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2);
 
       // sort the vector
-      OutOfPlaceVectorSorter<TinyIntVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<TinyIntVector> sorter = getSorter(generalSorter);
       VectorValueComparator<TinyIntVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -91,25 +89,26 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals((byte) 2, sortedVec.get(2));
-      Assert.assertEquals((byte) 8, sortedVec.get(3));
-      Assert.assertEquals((byte) 10, sortedVec.get(4));
-      Assert.assertEquals((byte) 10, sortedVec.get(5));
-      Assert.assertEquals((byte) 12, sortedVec.get(6));
-      Assert.assertEquals((byte) 17, sortedVec.get(7));
-      Assert.assertEquals((byte) 23, sortedVec.get(8));
-      Assert.assertEquals((byte) 35, sortedVec.get(9));
+      assertEquals((byte) 2, sortedVec.get(2));
+      assertEquals((byte) 8, sortedVec.get(3));
+      assertEquals((byte) 10, sortedVec.get(4));
+      assertEquals((byte) 10, sortedVec.get(5));
+      assertEquals((byte) 12, sortedVec.get(6));
+      assertEquals((byte) 17, sortedVec.get(7));
+      assertEquals((byte) 23, sortedVec.get(8));
+      assertEquals((byte) 35, sortedVec.get(9));
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortShort() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortShort(boolean generalSorter) {
     try (SmallIntVector vec = new SmallIntVector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -127,7 +126,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2);
 
       // sort the vector
-      OutOfPlaceVectorSorter<SmallIntVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<SmallIntVector> sorter = getSorter(generalSorter);
       VectorValueComparator<SmallIntVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -139,25 +138,26 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals((short) 2, sortedVec.get(2));
-      Assert.assertEquals((short) 8, sortedVec.get(3));
-      Assert.assertEquals((short) 10, sortedVec.get(4));
-      Assert.assertEquals((short) 10, sortedVec.get(5));
-      Assert.assertEquals((short) 12, sortedVec.get(6));
-      Assert.assertEquals((short) 17, sortedVec.get(7));
-      Assert.assertEquals((short) 23, sortedVec.get(8));
-      Assert.assertEquals((short) 35, sortedVec.get(9));
+      assertEquals((short) 2, sortedVec.get(2));
+      assertEquals((short) 8, sortedVec.get(3));
+      assertEquals((short) 10, sortedVec.get(4));
+      assertEquals((short) 10, sortedVec.get(5));
+      assertEquals((short) 12, sortedVec.get(6));
+      assertEquals((short) 17, sortedVec.get(7));
+      assertEquals((short) 23, sortedVec.get(8));
+      assertEquals((short) 35, sortedVec.get(9));
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortInt() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortInt(boolean generalSorter) {
     try (IntVector vec = new IntVector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -175,7 +175,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2);
 
       // sort the vector
-      OutOfPlaceVectorSorter<IntVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<IntVector> sorter = getSorter(generalSorter);
       VectorValueComparator<IntVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -187,25 +187,26 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals(2, sortedVec.get(2));
-      Assert.assertEquals(8, sortedVec.get(3));
-      Assert.assertEquals(10, sortedVec.get(4));
-      Assert.assertEquals(10, sortedVec.get(5));
-      Assert.assertEquals(12, sortedVec.get(6));
-      Assert.assertEquals(17, sortedVec.get(7));
-      Assert.assertEquals(23, sortedVec.get(8));
-      Assert.assertEquals(35, sortedVec.get(9));
+      assertEquals(2, sortedVec.get(2));
+      assertEquals(8, sortedVec.get(3));
+      assertEquals(10, sortedVec.get(4));
+      assertEquals(10, sortedVec.get(5));
+      assertEquals(12, sortedVec.get(6));
+      assertEquals(17, sortedVec.get(7));
+      assertEquals(23, sortedVec.get(8));
+      assertEquals(35, sortedVec.get(9));
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortLong() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortLong(boolean generalSorter) {
     try (BigIntVector vec = new BigIntVector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -223,7 +224,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2L);
 
       // sort the vector
-      OutOfPlaceVectorSorter<BigIntVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<BigIntVector> sorter = getSorter(generalSorter);
       VectorValueComparator<BigIntVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -235,25 +236,26 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals(2L, sortedVec.get(2));
-      Assert.assertEquals(8L, sortedVec.get(3));
-      Assert.assertEquals(10L, sortedVec.get(4));
-      Assert.assertEquals(10L, sortedVec.get(5));
-      Assert.assertEquals(12L, sortedVec.get(6));
-      Assert.assertEquals(17L, sortedVec.get(7));
-      Assert.assertEquals(23L, sortedVec.get(8));
-      Assert.assertEquals(1L << 35L, sortedVec.get(9));
+      assertEquals(2L, sortedVec.get(2));
+      assertEquals(8L, sortedVec.get(3));
+      assertEquals(10L, sortedVec.get(4));
+      assertEquals(10L, sortedVec.get(5));
+      assertEquals(12L, sortedVec.get(6));
+      assertEquals(17L, sortedVec.get(7));
+      assertEquals(23L, sortedVec.get(8));
+      assertEquals(1L << 35L, sortedVec.get(9));
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortFloat() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortFloat(boolean generalSorter) {
     try (Float4Vector vec = new Float4Vector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -271,7 +273,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2f);
 
       // sort the vector
-      OutOfPlaceVectorSorter<Float4Vector> sorter = getSorter();
+      OutOfPlaceVectorSorter<Float4Vector> sorter = getSorter(generalSorter);
       VectorValueComparator<Float4Vector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -283,25 +285,26 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals(2f, sortedVec.get(2), 0f);
-      Assert.assertEquals(8f, sortedVec.get(3), 0f);
-      Assert.assertEquals(10f, sortedVec.get(4), 0f);
-      Assert.assertEquals(10f, sortedVec.get(5), 0f);
-      Assert.assertEquals(12f, sortedVec.get(6), 0f);
-      Assert.assertEquals(17f, sortedVec.get(7), 0f);
-      Assert.assertEquals(23f, sortedVec.get(8), 0f);
-      Assert.assertEquals(Float.NaN, sortedVec.get(9), 0f);
+      assertEquals(2f, sortedVec.get(2), 0f);
+      assertEquals(8f, sortedVec.get(3), 0f);
+      assertEquals(10f, sortedVec.get(4), 0f);
+      assertEquals(10f, sortedVec.get(5), 0f);
+      assertEquals(12f, sortedVec.get(6), 0f);
+      assertEquals(17f, sortedVec.get(7), 0f);
+      assertEquals(23f, sortedVec.get(8), 0f);
+      assertEquals(Float.NaN, sortedVec.get(9), 0f);
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortDouble() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortDouble(boolean generalSorter) {
     try (Float8Vector vec = new Float8Vector("", allocator)) {
       vec.allocateNew(10);
       vec.setValueCount(10);
@@ -319,7 +322,7 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       vec.set(9, 2);
 
       // sort the vector
-      OutOfPlaceVectorSorter<Float8Vector> sorter = getSorter();
+      OutOfPlaceVectorSorter<Float8Vector> sorter = getSorter(generalSorter);
       VectorValueComparator<Float8Vector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -331,32 +334,33 @@ public class TestFixedWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSo
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
-      Assert.assertEquals(2, sortedVec.get(2), 0);
-      Assert.assertEquals(8, sortedVec.get(3), 0);
-      Assert.assertEquals(10, sortedVec.get(4), 0);
-      Assert.assertEquals(10, sortedVec.get(5), 0);
-      Assert.assertEquals(12, sortedVec.get(6), 0);
-      Assert.assertEquals(17, sortedVec.get(7), 0);
-      Assert.assertEquals(35, sortedVec.get(8), 0);
-      Assert.assertEquals(Double.NaN, sortedVec.get(9), 0);
+      assertEquals(2, sortedVec.get(2), 0);
+      assertEquals(8, sortedVec.get(3), 0);
+      assertEquals(10, sortedVec.get(4), 0);
+      assertEquals(10, sortedVec.get(5), 0);
+      assertEquals(12, sortedVec.get(6), 0);
+      assertEquals(17, sortedVec.get(7), 0);
+      assertEquals(35, sortedVec.get(8), 0);
+      assertEquals(Double.NaN, sortedVec.get(9), 0);
 
       sortedVec.close();
     }
   }
 
-  @Test
-  public void testSortInt2() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortInt2(boolean generalSorter) {
     try (IntVector vec = new IntVector("", allocator)) {
       ValueVectorDataPopulator.setVector(
           vec, 0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34, 35, 60, 61, 62, 63, 64, 
65, 6, 7, 8, 9, 10, 11,
           36, 37, 38, 39, 40, 41, 66, 67, 68, 69, 70, 71);
 
       // sort the vector
-      OutOfPlaceVectorSorter<IntVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<IntVector> sorter = getSorter(generalSorter);
       VectorValueComparator<IntVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthSorting.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthSorting.java
index a92cc77818..d9056d08f4 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthSorting.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestFixedWidthSorting.java
@@ -17,9 +17,9 @@
 package org.apache.arrow.algorithm.sort;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.function.Function;
+import java.util.stream.Stream;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.BaseFixedWidthVector;
@@ -29,66 +29,52 @@ import org.apache.arrow.vector.Float8Vector;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.SmallIntVector;
 import org.apache.arrow.vector.TinyIntVector;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test sorting fixed width vectors with random data. */
-@RunWith(Parameterized.class)
 public class TestFixedWidthSorting<V extends BaseFixedWidthVector, U extends 
Comparable<U>> {
 
   static final int[] VECTOR_LENGTHS = new int[] {2, 5, 10, 50, 100, 1000, 
3000};
 
   static final double[] NULL_FRACTIONS = {0, 0.1, 0.3, 0.5, 0.7, 0.9, 1};
 
-  private final int length;
-
-  private final double nullFraction;
-
-  private final boolean inPlace;
-
-  private final Function<BufferAllocator, V> vectorGenerator;
-
-  private final TestSortingUtil.DataGenerator<V, U> dataGenerator;
-
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(Integer.MAX_VALUE);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  public TestFixedWidthSorting(
+  @ParameterizedTest
+  @MethodSource("getParameters")
+  public void testSort(
+      boolean inPlace,
       int length,
       double nullFraction,
-      boolean inPlace,
       String desc,
       Function<BufferAllocator, V> vectorGenerator,
       TestSortingUtil.DataGenerator<V, U> dataGenerator) {
-    this.length = length;
-    this.nullFraction = nullFraction;
-    this.inPlace = inPlace;
-    this.vectorGenerator = vectorGenerator;
-    this.dataGenerator = dataGenerator;
-  }
-
-  @Test
-  public void testSort() {
     if (inPlace) {
-      sortInPlace();
+      sortInPlace(length, nullFraction, vectorGenerator, dataGenerator);
     } else {
-      sortOutOfPlace();
+      sortOutOfPlace(length, nullFraction, vectorGenerator, dataGenerator);
     }
   }
 
-  void sortInPlace() {
+  void sortInPlace(
+      int length,
+      double nullFraction,
+      Function<BufferAllocator, V> vectorGenerator,
+      TestSortingUtil.DataGenerator<V, U> dataGenerator) {
     try (V vector = vectorGenerator.apply(allocator)) {
       U[] array = dataGenerator.populate(vector, length, nullFraction);
       TestSortingUtil.sortArray(array);
@@ -103,7 +89,11 @@ public class TestFixedWidthSorting<V extends 
BaseFixedWidthVector, U extends Com
     }
   }
 
-  void sortOutOfPlace() {
+  void sortOutOfPlace(
+      int length,
+      double nullFraction,
+      Function<BufferAllocator, V> vectorGenerator,
+      TestSortingUtil.DataGenerator<V, U> dataGenerator) {
     try (V vector = vectorGenerator.apply(allocator)) {
       U[] array = dataGenerator.populate(vector, length, nullFraction);
       TestSortingUtil.sortArray(array);
@@ -126,81 +116,73 @@ public class TestFixedWidthSorting<V extends 
BaseFixedWidthVector, U extends Com
     }
   }
 
-  @Parameterized.Parameters(
-      name = "length = {0}, null fraction = {1}, in place = {2}, vector = {3}")
-  public static Collection<Object[]> getParameters() {
-    List<Object[]> params = new ArrayList<>();
+  public static Stream<Arguments> getParameters() {
+    List<Arguments> params = new ArrayList<>();
     for (int length : VECTOR_LENGTHS) {
       for (double nullFrac : NULL_FRACTIONS) {
         for (boolean inPlace : new boolean[] {true, false}) {
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "TinyIntVector",
-                (Function<BufferAllocator, TinyIntVector>)
-                    allocator -> new TinyIntVector("vector", allocator),
-                TestSortingUtil.TINY_INT_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "TinyIntVector",
+                  (Function<BufferAllocator, TinyIntVector>)
+                      allocator -> new TinyIntVector("vector", allocator),
+                  TestSortingUtil.TINY_INT_GENERATOR));
 
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "SmallIntVector",
-                (Function<BufferAllocator, SmallIntVector>)
-                    allocator -> new SmallIntVector("vector", allocator),
-                TestSortingUtil.SMALL_INT_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "SmallIntVector",
+                  (Function<BufferAllocator, SmallIntVector>)
+                      allocator -> new SmallIntVector("vector", allocator),
+                  TestSortingUtil.SMALL_INT_GENERATOR));
 
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "IntVector",
-                (Function<BufferAllocator, IntVector>)
-                    allocator -> new IntVector("vector", allocator),
-                TestSortingUtil.INT_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "IntVector",
+                  (Function<BufferAllocator, IntVector>)
+                      allocator -> new IntVector("vector", allocator),
+                  TestSortingUtil.INT_GENERATOR));
 
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "BigIntVector",
-                (Function<BufferAllocator, BigIntVector>)
-                    allocator -> new BigIntVector("vector", allocator),
-                TestSortingUtil.LONG_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "BigIntVector",
+                  (Function<BufferAllocator, BigIntVector>)
+                      allocator -> new BigIntVector("vector", allocator),
+                  TestSortingUtil.LONG_GENERATOR));
 
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "Float4Vector",
-                (Function<BufferAllocator, Float4Vector>)
-                    allocator -> new Float4Vector("vector", allocator),
-                TestSortingUtil.FLOAT_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "Float4Vector",
+                  (Function<BufferAllocator, Float4Vector>)
+                      allocator -> new Float4Vector("vector", allocator),
+                  TestSortingUtil.FLOAT_GENERATOR));
 
           params.add(
-              new Object[] {
-                length,
-                nullFrac,
-                inPlace,
-                "Float8Vector",
-                (Function<BufferAllocator, Float8Vector>)
-                    allocator -> new Float8Vector("vector", allocator),
-                TestSortingUtil.DOUBLE_GENERATOR
-              });
+              Arguments.of(
+                  inPlace,
+                  length,
+                  nullFrac,
+                  "Float8Vector",
+                  (Function<BufferAllocator, Float8Vector>)
+                      allocator -> new Float8Vector("vector", allocator),
+                  TestSortingUtil.DOUBLE_GENERATOR));
         }
       }
     }
-    return params;
+    return params.stream();
   }
 }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestGeneralOutOfPlaceVectorSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestGeneralOutOfPlaceVectorSorter.java
index 9e796a98ab..29f3331ff0 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestGeneralOutOfPlaceVectorSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestGeneralOutOfPlaceVectorSorter.java
@@ -16,7 +16,7 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
@@ -25,21 +25,21 @@ import org.apache.arrow.vector.complex.StructVector;
 import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
 import org.apache.arrow.vector.types.pojo.ArrowType;
 import org.apache.arrow.vector.types.pojo.FieldType;
-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;
 
 /** Test cases for {@link GeneralOutOfPlaceVectorSorter}. */
 public class TestGeneralOutOfPlaceVectorSorter {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestIndexSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestIndexSorter.java
index bc8aac08b6..ec6d2b71a3 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestIndexSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestIndexSorter.java
@@ -16,28 +16,28 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-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.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
-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;
 
 /** Test cases for {@link IndexSorter}. */
 public class TestIndexSorter {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestInsertionSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestInsertionSorter.java
index 3b16ac30d4..d0c1f6d6e5 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestInsertionSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestInsertionSorter.java
@@ -16,28 +16,28 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static org.junit.Assert.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.IntVector;
 import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
-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;
 
 /** Test cases for {@link InsertionSorter}. */
 public class TestInsertionSorter {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOffHeapIntStack.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOffHeapIntStack.java
index 025576f08e..f0c4bc86f7 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOffHeapIntStack.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOffHeapIntStack.java
@@ -16,26 +16,26 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-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;
 
 /** Test cases for {@link OffHeapIntStack}. */
 public class TestOffHeapIntStack {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOutOfPlaceVectorSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOutOfPlaceVectorSorter.java
index 4f6a8489c4..9358ef93b0 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOutOfPlaceVectorSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestOutOfPlaceVectorSorter.java
@@ -17,26 +17,18 @@
 package org.apache.arrow.algorithm.sort;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import java.util.stream.Stream;
+import org.junit.jupiter.params.provider.Arguments;
 
 /** Test cases for out-of-place sorters. */
-@RunWith(Parameterized.class)
 public abstract class TestOutOfPlaceVectorSorter {
 
-  protected final boolean generalSorter;
-
-  public TestOutOfPlaceVectorSorter(boolean generalSorter) {
-    this.generalSorter = generalSorter;
-  }
-
-  @Parameterized.Parameters(name = "general sorter = {0}")
-  public static Collection<Object[]> getParameter() {
-    List<Object[]> params = new ArrayList<>();
-    params.add(new Object[] {true});
-    params.add(new Object[] {false});
-    return params;
+  public static Stream<Arguments> getParameter() {
+    List<Arguments> args = new ArrayList<>();
+    for (boolean generalSorter : new boolean[] {false, true}) {
+      args.add(Arguments.of(generalSorter));
+    }
+    return args.stream();
   }
 }
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestStableVectorComparator.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestStableVectorComparator.java
index ce15940c1d..09ac963332 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestStableVectorComparator.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestStableVectorComparator.java
@@ -16,7 +16,7 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.nio.charset.StandardCharsets;
@@ -24,22 +24,21 @@ import java.util.Objects;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.VarCharVector;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link StableVectorComparator}. */
 public class TestStableVectorComparator {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -67,7 +66,7 @@ public class TestStableVectorComparator {
       assertTrue(stableComparator.compare(2, 3) < 0);
       assertTrue(stableComparator.compare(1, 3) < 0);
       assertTrue(stableComparator.compare(3, 1) > 0);
-      Assertions.assertEquals(0, stableComparator.compare(3, 3));
+      assertEquals(0, stableComparator.compare(3, 3));
     }
   }
 
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthOutOfPlaceVectorSorter.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthOutOfPlaceVectorSorter.java
index b3f2539fa5..6addec9e26 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthOutOfPlaceVectorSorter.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthOutOfPlaceVectorSorter.java
@@ -16,8 +16,8 @@
  */
 package org.apache.arrow.algorithm.sort;
 
-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.charset.StandardCharsets;
 import java.util.Objects;
@@ -25,38 +25,35 @@ import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.BaseVariableWidthVector;
 import org.apache.arrow.vector.VarCharVector;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test cases for {@link VariableWidthOutOfPlaceVectorSorter}. */
 public class TestVariableWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVectorSorter {
 
   private BufferAllocator allocator;
 
-  public TestVariableWidthOutOfPlaceVectorSorter(boolean generalSorter) {
-    super(generalSorter);
-  }
-
-  <V extends BaseVariableWidthVector> OutOfPlaceVectorSorter<V> getSorter() {
+  <V extends BaseVariableWidthVector> OutOfPlaceVectorSorter<V> 
getSorter(boolean generalSorter) {
     return generalSorter
         ? new GeneralOutOfPlaceVectorSorter<>()
         : new VariableWidthOutOfPlaceVectorSorter<V>();
   }
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  @Test
-  public void testSortString() {
+  @ParameterizedTest
+  @MethodSource("getParameter")
+  public void testSortString(boolean generalSorter) {
     try (VarCharVector vec = new VarCharVector("", allocator)) {
       vec.allocateNew(100, 10);
       vec.setValueCount(10);
@@ -74,7 +71,7 @@ public class TestVariableWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVecto
       vec.set(9, "yes".getBytes(StandardCharsets.UTF_8));
 
       // sort the vector
-      OutOfPlaceVectorSorter<BaseVariableWidthVector> sorter = getSorter();
+      OutOfPlaceVectorSorter<BaseVariableWidthVector> sorter = 
getSorter(generalSorter);
       VectorValueComparator<BaseVariableWidthVector> comparator =
           DefaultVectorComparators.createDefaultComparator(vec);
 
@@ -87,9 +84,9 @@ public class TestVariableWidthOutOfPlaceVectorSorter extends 
TestOutOfPlaceVecto
       sorter.sortOutOfPlace(vec, sortedVec, comparator);
 
       // verify results
-      Assert.assertEquals(vec.getValueCount(), sortedVec.getValueCount());
-      Assert.assertEquals(vec.getByteCapacity(), sortedVec.getByteCapacity());
-      Assert.assertEquals(vec.getLastSet(), sortedVec.getLastSet());
+      assertEquals(vec.getValueCount(), sortedVec.getValueCount());
+      assertEquals(vec.getByteCapacity(), sortedVec.getByteCapacity());
+      assertEquals(vec.getLastSet(), sortedVec.getLastSet());
 
       assertTrue(sortedVec.isNull(0));
       assertTrue(sortedVec.isNull(1));
diff --git 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthSorting.java
 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthSorting.java
index 5c37ddf928..60a5600764 100644
--- 
a/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthSorting.java
+++ 
b/java/algorithm/src/test/java/org/apache/arrow/algorithm/sort/TestVariableWidthSorting.java
@@ -23,68 +23,56 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Comparator;
 import java.util.List;
 import java.util.function.Function;
+import java.util.stream.Stream;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.vector.BaseVariableWidthVector;
 import org.apache.arrow.vector.ValueVector;
 import org.apache.arrow.vector.VarCharVector;
 import org.apache.arrow.vector.util.Text;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
 /** Test sorting variable width vectors with random data. */
-@RunWith(Parameterized.class)
 public class TestVariableWidthSorting<V extends BaseVariableWidthVector, U 
extends Comparable<U>> {
 
   static final int[] VECTOR_LENGTHS = new int[] {2, 5, 10, 50, 100, 1000, 
3000};
 
   static final double[] NULL_FRACTIONS = {0, 0.1, 0.3, 0.5, 0.7, 0.9, 1};
 
-  private final int length;
-
-  private final double nullFraction;
-
-  private final Function<BufferAllocator, V> vectorGenerator;
-
-  private final TestSortingUtil.DataGenerator<V, U> dataGenerator;
-
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(Integer.MAX_VALUE);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  public TestVariableWidthSorting(
+  @ParameterizedTest
+  @MethodSource("getParameters")
+  public void testSort(
       int length,
       double nullFraction,
-      String desc,
       Function<BufferAllocator, V> vectorGenerator,
       TestSortingUtil.DataGenerator<V, U> dataGenerator) {
-    this.length = length;
-    this.nullFraction = nullFraction;
-    this.vectorGenerator = vectorGenerator;
-    this.dataGenerator = dataGenerator;
-  }
-
-  @Test
-  public void testSort() {
-    sortOutOfPlace();
+    sortOutOfPlace(length, nullFraction, vectorGenerator, dataGenerator);
   }
 
-  void sortOutOfPlace() {
+  void sortOutOfPlace(
+      int length,
+      double nullFraction,
+      Function<BufferAllocator, V> vectorGenerator,
+      TestSortingUtil.DataGenerator<V, U> dataGenerator) {
     try (V vector = vectorGenerator.apply(allocator)) {
       U[] array = dataGenerator.populate(vector, length, nullFraction);
       Arrays.sort(array, (Comparator<? super U>) new StringComparator());
@@ -108,23 +96,20 @@ public class TestVariableWidthSorting<V extends 
BaseVariableWidthVector, U exten
     }
   }
 
-  @Parameterized.Parameters(name = "length = {0}, null fraction = {1}, vector 
= {2}")
-  public static Collection<Object[]> getParameters() {
-    List<Object[]> params = new ArrayList<>();
+  public static Stream<Arguments> getParameters() {
+    List<Arguments> params = new ArrayList<>();
     for (int length : VECTOR_LENGTHS) {
       for (double nullFrac : NULL_FRACTIONS) {
         params.add(
-            new Object[] {
-              length,
-              nullFrac,
-              "VarCharVector",
-              (Function<BufferAllocator, VarCharVector>)
-                  allocator -> new VarCharVector("vector", allocator),
-              TestSortingUtil.STRING_GENERATOR
-            });
+            Arguments.of(
+                length,
+                nullFrac,
+                (Function<BufferAllocator, VarCharVector>)
+                    allocator -> new VarCharVector("vector", allocator),
+                TestSortingUtil.STRING_GENERATOR));
       }
     }
-    return params;
+    return params.stream();
   }
 
   /** Verify results as byte arrays. */

Reply via email to