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 ad4ff471c1 GH-42165:[Java] Update Unit Tests for Memory Module (#42161)
ad4ff471c1 is described below

commit ad4ff471c1fc517edabe0c886daade804043a38e
Author: Ed <[email protected]>
AuthorDate: Mon Jun 17 01:17:35 2024 -0400

    GH-42165:[Java] Update Unit Tests for Memory Module (#42161)
    
    
    
    ### Rationale for this change
    
    ### What changes are included in this PR?
    
    I followed the format for the other sub-issues of GH-41680 (flight, etc.)
    
    ### Are these changes tested?
    Yes. This is actually migration of tests from JUnit 4 to JUnit 5. They  
pass.
    
    ### Are there any user-facing changes?
    
    * GitHub Issue: #41680
    * GitHub Issue: #42165
    
    Authored-by: Ed and Gravy <[email protected]>
    Signed-off-by: David Li <[email protected]>
---
 .../org/apache/arrow/memory/TestAccountant.java    |  11 +-
 .../apache/arrow/memory/TestAllocationManager.java |   4 +-
 .../java/org/apache/arrow/memory/TestArrowBuf.java |  34 +--
 .../org/apache/arrow/memory/TestBaseAllocator.java | 286 ++++++++++-----------
 .../apache/arrow/memory/TestBoundaryChecking.java  |  14 +-
 .../apache/arrow/memory/TestForeignAllocation.java |  54 ++--
 .../arrow/memory/TestLowCostIdentityHashMap.java   |  25 +-
 .../java/org/apache/arrow/memory/TestOpens.java    |   2 +-
 .../arrow/memory/util/TestArrowBufPointer.java     |  24 +-
 .../arrow/memory/util/TestByteFunctionHelpers.java |  12 +-
 .../arrow/memory/util/TestLargeMemoryUtil.java     |  25 +-
 .../arrow/memory/util/hash/TestArrowBufHasher.java | 107 ++++----
 .../org/apache/arrow/util/TestCollections2.java    |   7 +-
 .../netty/buffer/TestUnsafeDirectLittleEndian.java |  37 +--
 .../io/netty/buffer/TestExpandableByteBuf.java     |  35 +--
 .../java/io/netty/buffer/TestNettyArrowBuf.java    |  46 ++--
 .../arrow/memory/netty/ITTestLargeArrowBuf.java    |   4 +-
 .../memory/netty/TestAllocationManagerNetty.java   |   4 +-
 .../arrow/memory/netty/TestEmptyArrowBuf.java      |  17 +-
 .../apache/arrow/memory/netty/TestEndianness.java  |   4 +-
 .../memory/netty/TestNettyAllocationManager.java   |  18 +-
 .../arrow/memory/netty/TestNettyAllocator.java     |   8 +-
 .../memory/unsafe/TestAllocationManagerUnsafe.java |   4 +-
 .../memory/unsafe/TestUnsafeAllocationManager.java |  10 +-
 24 files changed, 398 insertions(+), 394 deletions(-)

diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAccountant.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAccountant.java
index 98f36f357b..07663b4ab6 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAccountant.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAccountant.java
@@ -16,10 +16,11 @@
  */
 package org.apache.arrow.memory;
 
-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.fail;
 
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestAccountant {
 
@@ -56,7 +57,7 @@ public class TestAccountant {
                 }
               } catch (Exception ex) {
                 ex.printStackTrace();
-                Assert.fail(ex.getMessage());
+                fail(ex.getMessage());
               }
             }
           };
@@ -151,7 +152,7 @@ public class TestAccountant {
     assertEquals(2, parent.getAllocatedMemory());
 
     boolean withinLimit = child.forceAllocate(10);
-    assertEquals(false, withinLimit);
+    assertFalse(withinLimit);
 
     // at new limit
     assertEquals(child.getAllocatedMemory(), 11);
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAllocationManager.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAllocationManager.java
index 6ac09529e9..b1a360a7b3 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAllocationManager.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestAllocationManager.java
@@ -16,9 +16,9 @@
  */
 package org.apache.arrow.memory;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link AllocationManager}. */
 public class TestAllocationManager {
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestArrowBuf.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestArrowBuf.java
index a2feaeaf8b..60e118d557 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestArrowBuf.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestArrowBuf.java
@@ -16,11 +16,11 @@
  */
 package org.apache.arrow.memory;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThrows;
-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.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.Logger;
@@ -30,35 +30,35 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Arrays;
 import org.apache.arrow.memory.util.Float16;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.LoggerFactory;
 
 public class TestArrowBuf {
 
-  @Test(expected = IndexOutOfBoundsException.class)
+  @Test
   public void testSliceOutOfBoundsLength_RaisesIndexOutOfBoundsException() {
     try (BufferAllocator allocator = new RootAllocator(128);
         ArrowBuf buf = allocator.buffer(2)) {
       assertEquals(2, buf.capacity());
-      buf.slice(0, 3);
+      assertThrows(IndexOutOfBoundsException.class, () -> buf.slice(0, 3));
     }
   }
 
-  @Test(expected = IndexOutOfBoundsException.class)
+  @Test
   public void 
testSliceOutOfBoundsIndexPlusLength_RaisesIndexOutOfBoundsException() {
     try (BufferAllocator allocator = new RootAllocator(128);
         ArrowBuf buf = allocator.buffer(2)) {
       assertEquals(2, buf.capacity());
-      buf.slice(1, 2);
+      assertThrows(IndexOutOfBoundsException.class, () -> buf.slice(1, 2));
     }
   }
 
-  @Test(expected = IndexOutOfBoundsException.class)
+  @Test
   public void testSliceOutOfBoundsIndex_RaisesIndexOutOfBoundsException() {
     try (BufferAllocator allocator = new RootAllocator(128);
         ArrowBuf buf = allocator.buffer(2)) {
       assertEquals(2, buf.capacity());
-      buf.slice(3, 0);
+      assertThrows(IndexOutOfBoundsException.class, () -> buf.slice(3, 0));
     }
   }
 
@@ -143,7 +143,7 @@ public class TestArrowBuf {
     ((Logger) 
LoggerFactory.getLogger("org.apache.arrow")).setLevel(Level.TRACE);
     try (BufferAllocator allocator = new RootAllocator(128)) {
       allocator.buffer(2);
-      Exception e = assertThrows(IllegalStateException.class, () -> 
allocator.close());
+      Exception e = assertThrows(IllegalStateException.class, 
allocator::close);
       assertFalse(e.getMessage().contains("event log for:"));
     } finally {
       ((Logger) LoggerFactory.getLogger("org.apache.arrow")).setLevel(null);
@@ -164,15 +164,15 @@ public class TestArrowBuf {
         allocator.buffer(2);
         Exception e = assertThrows(IllegalStateException.class, 
allocator::close);
         assertTrue(
-            "Exception had the following message: " + e.getMessage(),
-            e.getMessage().contains("event log for:")); // JDK8, JDK11
+            e.getMessage().contains("event log for:"), // JDK8, JDK11
+            "Exception had the following message: " + e.getMessage());
       } finally {
         fieldDebug.set(null, false);
       }
     } catch (Exception e) {
       assertTrue(
-          "Exception had the following toString(): " + e.toString(),
-          e.toString().contains("java.lang.NoSuchFieldException: modifiers")); 
// JDK17+
+          e.toString().contains("java.lang.NoSuchFieldException: modifiers"),
+          "Exception had the following toString(): " + e); // JDK17+
     } finally {
       ((Logger) LoggerFactory.getLogger("org.apache.arrow")).setLevel(null);
     }
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
index ec63440115..d7d7fde00a 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBaseAllocator.java
@@ -16,13 +16,14 @@
  */
 package org.apache.arrow.memory;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.lang.reflect.Field;
 import java.util.Arrays;
@@ -33,10 +34,8 @@ import 
org.apache.arrow.memory.AllocationOutcomeDetails.Entry;
 import org.apache.arrow.memory.rounding.RoundingPolicy;
 import org.apache.arrow.memory.rounding.SegmentRoundingPolicy;
 import org.apache.arrow.memory.util.AssertionUtil;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 import sun.misc.Unsafe;
 
 public class TestBaseAllocator {
@@ -69,12 +68,12 @@ public class TestBaseAllocator {
   public void test_privateMax() throws Exception {
     try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
       final ArrowBuf arrowBuf1 = rootAllocator.buffer(MAX_ALLOCATION / 2);
-      assertNotNull("allocation failed", arrowBuf1);
+      assertNotNull(arrowBuf1, "allocation failed");
 
       try (final BufferAllocator childAllocator =
           rootAllocator.newChildAllocator("noLimits", 0, MAX_ALLOCATION)) {
         final ArrowBuf arrowBuf2 = childAllocator.buffer(MAX_ALLOCATION / 2);
-        assertNotNull("allocation failed", arrowBuf2);
+        assertNotNull(arrowBuf2, "allocation failed");
         arrowBuf2.getReferenceManager().release();
       }
 
@@ -82,47 +81,55 @@ public class TestBaseAllocator {
     }
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testRootAllocator_closeWithOutstanding() throws Exception {
-    try {
-      try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
-        final ArrowBuf arrowBuf = rootAllocator.buffer(512);
-        assertNotNull("allocation failed", arrowBuf);
-      }
-    } finally {
-      /*
-       * We expect there to be one unreleased underlying buffer because we're 
closing
-       * without releasing it.
-       */
-      /*
-      // ------------------------------- DEBUG 
---------------------------------
-      final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
-      UnsafeDirectLittleEndian.releaseBuffers();
-      assertEquals(1, bufferCount);
-      // ------------------------------- DEBUG 
---------------------------------
-      */
-    }
+    assertThrows(
+        IllegalStateException.class,
+        () -> {
+          try {
+            try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
+              final ArrowBuf arrowBuf = rootAllocator.buffer(512);
+              assertNotNull(arrowBuf, "allocation failed");
+            }
+          } finally {
+            /*
+             * We expect there to be one unreleased underlying buffer because 
we're closing
+             * without releasing it.
+             */
+            /*
+            // ------------------------------- DEBUG 
---------------------------------
+            final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
+            UnsafeDirectLittleEndian.releaseBuffers();
+            assertEquals(1, bufferCount);
+            // ------------------------------- DEBUG 
---------------------------------
+            */
+          }
+        });
   }
 
   @Test
-  @Ignore
+  @Disabled
   public void testRootAllocator_getEmpty() throws Exception {
     try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
       final ArrowBuf arrowBuf = rootAllocator.buffer(0);
-      assertNotNull("allocation failed", arrowBuf);
-      assertEquals("capacity was non-zero", 0, arrowBuf.capacity());
-      assertTrue("address should be valid", arrowBuf.memoryAddress() != 0);
+      assertNotNull(arrowBuf, "allocation failed");
+      assertEquals(0, arrowBuf.capacity(), "capacity was non-zero");
+      assertTrue(arrowBuf.memoryAddress() != 0, "address should be valid");
       arrowBuf.getReferenceManager().release();
     }
   }
 
-  @Ignore // TODO(DRILL-2740)
-  @Test(expected = IllegalStateException.class)
+  @Disabled // TODO(DRILL-2740)
+  @Test
   public void testAllocator_unreleasedEmpty() throws Exception {
-    try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
-      @SuppressWarnings("unused")
-      final ArrowBuf arrowBuf = rootAllocator.buffer(0);
-    }
+    assertThrows(
+        IllegalStateException.class,
+        () -> {
+          try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
+            @SuppressWarnings("unused")
+            final ArrowBuf arrowBuf = rootAllocator.buffer(0);
+          }
+        });
   }
 
   @Test
@@ -159,7 +166,7 @@ public class TestBaseAllocator {
   @Test
   public void testAllocator_getParentAndChild() throws Exception {
     try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
-      assertEquals(rootAllocator.getParentAllocator(), null);
+      assertNull(rootAllocator.getParentAllocator());
 
       try (final BufferAllocator childAllocator1 =
           rootAllocator.newChildAllocator("child1", 0, MAX_ALLOCATION)) {
@@ -273,34 +280,38 @@ public class TestBaseAllocator {
       try (final BufferAllocator childAllocator =
           rootAllocator.newChildAllocator("createChildAndUse", 0, 
MAX_ALLOCATION)) {
         final ArrowBuf arrowBuf = childAllocator.buffer(512);
-        assertNotNull("allocation failed", arrowBuf);
+        assertNotNull(arrowBuf, "allocation failed");
         arrowBuf.getReferenceManager().release();
       }
     }
   }
 
-  @Test(expected = IllegalStateException.class)
+  @Test
   public void testRootAllocator_createChildDontClose() throws Exception {
-    try {
-      try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
-        final BufferAllocator childAllocator =
-            rootAllocator.newChildAllocator("createChildDontClose", 0, 
MAX_ALLOCATION);
-        final ArrowBuf arrowBuf = childAllocator.buffer(512);
-        assertNotNull("allocation failed", arrowBuf);
-      }
-    } finally {
-      /*
-       * We expect one underlying buffer because we closed a child allocator 
without
-       * releasing the buffer allocated from it.
-       */
-      /*
-      // ------------------------------- DEBUG 
---------------------------------
-      final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
-      UnsafeDirectLittleEndian.releaseBuffers();
-      assertEquals(1, bufferCount);
-      // ------------------------------- DEBUG 
---------------------------------
-      */
-    }
+    assertThrows(
+        IllegalStateException.class,
+        () -> {
+          try {
+            try (final RootAllocator rootAllocator = new 
RootAllocator(MAX_ALLOCATION)) {
+              final BufferAllocator childAllocator =
+                  rootAllocator.newChildAllocator("createChildDontClose", 0, 
MAX_ALLOCATION);
+              final ArrowBuf arrowBuf = childAllocator.buffer(512);
+              assertNotNull(arrowBuf, "allocation failed");
+            }
+          } finally {
+            /*
+             * We expect one underlying buffer because we closed a child 
allocator without
+             * releasing the buffer allocated from it.
+             */
+            /*
+            // ------------------------------- DEBUG 
---------------------------------
+            final int bufferCount = UnsafeDirectLittleEndian.getBufferCount();
+            UnsafeDirectLittleEndian.releaseBuffers();
+            assertEquals(1, bufferCount);
+            // ------------------------------- DEBUG 
---------------------------------
+            */
+          }
+        });
   }
 
   @Test
@@ -347,16 +358,14 @@ public class TestBaseAllocator {
   @Test
   public void testSegmentAllocator_smallSegment() {
     IllegalArgumentException e =
-        Assertions.assertThrows(
-            IllegalArgumentException.class, () -> new 
SegmentRoundingPolicy(128));
+        assertThrows(IllegalArgumentException.class, () -> new 
SegmentRoundingPolicy(128));
     assertEquals("The segment size cannot be smaller than 1024", 
e.getMessage());
   }
 
   @Test
   public void testSegmentAllocator_segmentSizeNotPowerOf2() {
     IllegalArgumentException e =
-        Assertions.assertThrows(
-            IllegalArgumentException.class, () -> new 
SegmentRoundingPolicy(4097));
+        assertThrows(IllegalArgumentException.class, () -> new 
SegmentRoundingPolicy(4097));
     assertEquals("The segment size must be a power of 2", e.getMessage());
   }
 
@@ -364,7 +373,7 @@ public class TestBaseAllocator {
   public void testCustomizedAllocationManager() {
     try (BaseAllocator allocator = 
createAllocatorWithCustomizedAllocationManager()) {
       final ArrowBuf arrowBuf1 = allocator.buffer(MAX_ALLOCATION);
-      assertNotNull("allocation failed", arrowBuf1);
+      assertNotNull(arrowBuf1, "allocation failed");
 
       arrowBuf1.setInt(0, 1);
       assertEquals(1, arrowBuf1.getInt(0));
@@ -443,74 +452,74 @@ public class TestBaseAllocator {
   @Test
   public void testRootAllocator_listeners() throws Exception {
     CountingAllocationListener listener1 = new CountingAllocationListener();
-    Assert.assertEquals(0, listener1.getNumPreCalls());
-    Assert.assertEquals(0, listener1.getNumCalls());
-    Assert.assertEquals(0, listener1.getNumReleaseCalls());
-    Assert.assertEquals(0, listener1.getNumChildren());
-    Assert.assertEquals(0, listener1.getTotalMem());
+    assertEquals(0, listener1.getNumPreCalls());
+    assertEquals(0, listener1.getNumCalls());
+    assertEquals(0, listener1.getNumReleaseCalls());
+    assertEquals(0, listener1.getNumChildren());
+    assertEquals(0, listener1.getTotalMem());
     CountingAllocationListener listener2 = new CountingAllocationListener();
-    Assert.assertEquals(0, listener2.getNumPreCalls());
-    Assert.assertEquals(0, listener2.getNumCalls());
-    Assert.assertEquals(0, listener2.getNumReleaseCalls());
-    Assert.assertEquals(0, listener2.getNumChildren());
-    Assert.assertEquals(0, listener2.getTotalMem());
+    assertEquals(0, listener2.getNumPreCalls());
+    assertEquals(0, listener2.getNumCalls());
+    assertEquals(0, listener2.getNumReleaseCalls());
+    assertEquals(0, listener2.getNumChildren());
+    assertEquals(0, listener2.getTotalMem());
     // root and first-level child share the first listener
     // second-level and third-level child share the second listener
     try (final RootAllocator rootAllocator = new RootAllocator(listener1, 
MAX_ALLOCATION)) {
       try (final BufferAllocator c1 = rootAllocator.newChildAllocator("c1", 0, 
MAX_ALLOCATION)) {
-        Assert.assertEquals(1, listener1.getNumChildren());
+        assertEquals(1, listener1.getNumChildren());
         final ArrowBuf buf1 = c1.buffer(16);
-        assertNotNull("allocation failed", buf1);
-        Assert.assertEquals(1, listener1.getNumPreCalls());
-        Assert.assertEquals(1, listener1.getNumCalls());
-        Assert.assertEquals(0, listener1.getNumReleaseCalls());
-        Assert.assertEquals(16, listener1.getTotalMem());
+        assertNotNull(buf1, "allocation failed");
+        assertEquals(1, listener1.getNumPreCalls());
+        assertEquals(1, listener1.getNumCalls());
+        assertEquals(0, listener1.getNumReleaseCalls());
+        assertEquals(16, listener1.getTotalMem());
         buf1.getReferenceManager().release();
         try (final BufferAllocator c2 = c1.newChildAllocator("c2", listener2, 
0, MAX_ALLOCATION)) {
-          Assert.assertEquals(
+          assertEquals(
               2, listener1.getNumChildren()); // c1 got a new child, so 
listener1 is notified.
-          Assert.assertEquals(0, listener2.getNumChildren());
+          assertEquals(0, listener2.getNumChildren());
           final ArrowBuf buf2 = c2.buffer(32);
-          assertNotNull("allocation failed", buf2);
-          Assert.assertEquals(1, listener1.getNumCalls());
-          Assert.assertEquals(16, listener1.getTotalMem());
-          Assert.assertEquals(1, listener2.getNumPreCalls());
-          Assert.assertEquals(1, listener2.getNumCalls());
-          Assert.assertEquals(0, listener2.getNumReleaseCalls());
-          Assert.assertEquals(32, listener2.getTotalMem());
+          assertNotNull(buf2, "allocation failed");
+          assertEquals(1, listener1.getNumCalls());
+          assertEquals(16, listener1.getTotalMem());
+          assertEquals(1, listener2.getNumPreCalls());
+          assertEquals(1, listener2.getNumCalls());
+          assertEquals(0, listener2.getNumReleaseCalls());
+          assertEquals(32, listener2.getTotalMem());
           buf2.getReferenceManager().release();
           try (final BufferAllocator c3 = c2.newChildAllocator("c3", 0, 
MAX_ALLOCATION)) {
-            Assert.assertEquals(2, listener1.getNumChildren());
-            Assert.assertEquals(1, listener2.getNumChildren());
+            assertEquals(2, listener1.getNumChildren());
+            assertEquals(1, listener2.getNumChildren());
             final ArrowBuf buf3 = c3.buffer(64);
-            assertNotNull("allocation failed", buf3);
-            Assert.assertEquals(1, listener1.getNumPreCalls());
-            Assert.assertEquals(1, listener1.getNumCalls());
-            Assert.assertEquals(1, listener1.getNumReleaseCalls());
-            Assert.assertEquals(16, listener1.getTotalMem());
-            Assert.assertEquals(2, listener2.getNumPreCalls());
-            Assert.assertEquals(2, listener2.getNumCalls());
-            Assert.assertEquals(1, listener2.getNumReleaseCalls());
-            Assert.assertEquals(32 + 64, listener2.getTotalMem());
+            assertNotNull(buf3, "allocation failed");
+            assertEquals(1, listener1.getNumPreCalls());
+            assertEquals(1, listener1.getNumCalls());
+            assertEquals(1, listener1.getNumReleaseCalls());
+            assertEquals(16, listener1.getTotalMem());
+            assertEquals(2, listener2.getNumPreCalls());
+            assertEquals(2, listener2.getNumCalls());
+            assertEquals(1, listener2.getNumReleaseCalls());
+            assertEquals(32 + 64, listener2.getTotalMem());
             buf3.getReferenceManager().release();
           }
-          Assert.assertEquals(2, listener1.getNumChildren());
-          Assert.assertEquals(0, listener2.getNumChildren()); // third-level 
child removed
+          assertEquals(2, listener1.getNumChildren());
+          assertEquals(0, listener2.getNumChildren()); // third-level child 
removed
         }
-        Assert.assertEquals(1, listener1.getNumChildren()); // second-level 
child removed
-        Assert.assertEquals(0, listener2.getNumChildren());
+        assertEquals(1, listener1.getNumChildren()); // second-level child 
removed
+        assertEquals(0, listener2.getNumChildren());
       }
-      Assert.assertEquals(0, listener1.getNumChildren()); // first-level child 
removed
+      assertEquals(0, listener1.getNumChildren()); // first-level child removed
 
-      Assert.assertEquals(2, listener2.getNumReleaseCalls());
+      assertEquals(2, listener2.getNumReleaseCalls());
     }
   }
 
   @Test
   public void testRootAllocator_listenerAllocationFail() throws Exception {
     CountingAllocationListener listener1 = new CountingAllocationListener();
-    Assert.assertEquals(0, listener1.getNumCalls());
-    Assert.assertEquals(0, listener1.getTotalMem());
+    assertEquals(0, listener1.getNumCalls());
+    assertEquals(0, listener1.getTotalMem());
     // Test attempts to allocate too much from a child whose limit is set to 
half of the max
     // allocation. The listener's callback triggers, expanding the child 
allocator's limit, so then
     // the allocation succeeds.
@@ -523,14 +532,14 @@ public class TestBaseAllocator {
         } catch (OutOfMemoryException e) {
           // expected
         }
-        Assert.assertEquals(0, listener1.getNumCalls());
-        Assert.assertEquals(0, listener1.getTotalMem());
+        assertEquals(0, listener1.getNumCalls());
+        assertEquals(0, listener1.getTotalMem());
 
         listener1.setExpandOnFail(c1, MAX_ALLOCATION);
         ArrowBuf arrowBuf = c1.buffer(MAX_ALLOCATION);
-        assertNotNull("allocation failed", arrowBuf);
-        Assert.assertEquals(1, listener1.getNumCalls());
-        Assert.assertEquals(MAX_ALLOCATION, listener1.getTotalMem());
+        assertNotNull(arrowBuf, "allocation failed");
+        assertEquals(1, listener1.getNumCalls());
+        assertEquals(MAX_ALLOCATION, listener1.getTotalMem());
         arrowBuf.getReferenceManager().release();
       }
     }
@@ -538,18 +547,18 @@ public class TestBaseAllocator {
 
   private static void allocateAndFree(final BufferAllocator allocator) {
     final ArrowBuf arrowBuf = allocator.buffer(512);
-    assertNotNull("allocation failed", arrowBuf);
+    assertNotNull(arrowBuf, "allocation failed");
     arrowBuf.getReferenceManager().release();
 
     final ArrowBuf arrowBuf2 = allocator.buffer(MAX_ALLOCATION);
-    assertNotNull("allocation failed", arrowBuf2);
+    assertNotNull(arrowBuf2, "allocation failed");
     arrowBuf2.getReferenceManager().release();
 
     final int nBufs = 8;
     final ArrowBuf[] arrowBufs = new ArrowBuf[nBufs];
     for (int i = 0; i < arrowBufs.length; ++i) {
       ArrowBuf arrowBufi = allocator.buffer(MAX_ALLOCATION / nBufs);
-      assertNotNull("allocation failed", arrowBufi);
+      assertNotNull(arrowBufi, "allocation failed");
       arrowBufs[i] = arrowBufi;
     }
     for (ArrowBuf arrowBufi : arrowBufs) {
@@ -590,9 +599,9 @@ public class TestBaseAllocator {
       try (final BufferAllocator childAllocator =
           rootAllocator.newChildAllocator("overAllocateParent", 0, 
MAX_ALLOCATION)) {
         final ArrowBuf arrowBuf1 = rootAllocator.buffer(MAX_ALLOCATION / 2);
-        assertNotNull("allocation failed", arrowBuf1);
+        assertNotNull(arrowBuf1, "allocation failed");
         final ArrowBuf arrowBuf2 = childAllocator.buffer(MAX_ALLOCATION / 2);
-        assertNotNull("allocation failed", arrowBuf2);
+        assertNotNull(arrowBuf2, "allocation failed");
 
         try {
           childAllocator.buffer(MAX_ALLOCATION / 4);
@@ -620,7 +629,7 @@ public class TestBaseAllocator {
           // expected
           assertTrue(e.getMessage().contains("Unable to allocate buffer"));
 
-          assertTrue("missing outcome details", 
e.getOutcomeDetails().isPresent());
+          assertTrue(e.getOutcomeDetails().isPresent(), "missing outcome 
details");
           AllocationOutcomeDetails outcomeDetails = 
e.getOutcomeDetails().get();
 
           assertEquals(outcomeDetails.getFailedAllocator(), childAllocator);
@@ -631,12 +640,12 @@ public class TestBaseAllocator {
           AllocationOutcomeDetails.Entry first = iterator.next();
           assertEquals(MAX_ALLOCATION / 4, first.getAllocatedSize());
           assertEquals(MAX_ALLOCATION, first.getRequestedSize());
-          assertEquals(false, first.isAllocationFailed());
+          assertFalse(first.isAllocationFailed());
 
           AllocationOutcomeDetails.Entry second = iterator.next();
           assertEquals(MAX_ALLOCATION - MAX_ALLOCATION / 4, 
second.getRequestedSize());
           assertEquals(0, second.getAllocatedSize());
-          assertEquals(true, second.isAllocationFailed());
+          assertTrue(second.isAllocationFailed());
 
           assertFalse(iterator.hasNext());
         }
@@ -656,7 +665,7 @@ public class TestBaseAllocator {
                   OutOfMemoryException.class, () -> 
grandChildAllocator.buffer(MAX_ALLOCATION * 2));
 
           assertTrue(e.getMessage().contains("Unable to allocate buffer"));
-          assertTrue("missing outcome details", 
e.getOutcomeDetails().isPresent());
+          assertTrue(e.getOutcomeDetails().isPresent(), "missing outcome 
details");
           AllocationOutcomeDetails outcomeDetails = 
e.getOutcomeDetails().get();
 
           assertEquals(outcomeDetails.getFailedAllocator(), rootAllocator);
@@ -667,16 +676,16 @@ public class TestBaseAllocator {
           AllocationOutcomeDetails.Entry first = iterator.next();
           assertEquals(MAX_ALLOCATION / 4, first.getAllocatedSize());
           assertEquals(2 * MAX_ALLOCATION, first.getRequestedSize());
-          assertEquals(false, first.isAllocationFailed());
+          assertFalse(first.isAllocationFailed());
 
           AllocationOutcomeDetails.Entry second = iterator.next();
           assertEquals(MAX_ALLOCATION / 4, second.getAllocatedSize());
           assertEquals(2 * MAX_ALLOCATION - MAX_ALLOCATION / 4, 
second.getRequestedSize());
-          assertEquals(false, second.isAllocationFailed());
+          assertFalse(second.isAllocationFailed());
 
           AllocationOutcomeDetails.Entry third = iterator.next();
           assertEquals(0, third.getAllocatedSize());
-          assertEquals(true, third.isAllocationFailed());
+          assertTrue(third.isAllocationFailed());
 
           assertFalse(iterator.hasNext());
         }
@@ -1075,13 +1084,14 @@ public class TestBaseAllocator {
   // The test passes if run individually with 
-Dtest=TestBaseAllocator#testMemoryLeakWithReservation
   // but fails generally since the assertion status cannot be changed once the 
class is initialized.
   // So setting the test to @ignore
-  @Test(expected = IllegalStateException.class)
-  @Ignore
+  @Test
+  @Disabled
   public void testMemoryLeakWithReservation() throws Exception {
     // disabling assertion status
     AssertionUtil.class
         .getClassLoader()
         .setClassAssertionStatus(AssertionUtil.class.getName(), false);
+
     try (RootAllocator rootAllocator = new RootAllocator(MAX_ALLOCATION)) {
       ChildAllocator childAllocator1 =
           (ChildAllocator) rootAllocator.newChildAllocator("child1", 1024, 
MAX_ALLOCATION);
@@ -1093,21 +1103,11 @@ public class TestBaseAllocator {
 
       childAllocator2.buffer(256);
 
-      Exception exception =
-          assertThrows(
-              IllegalStateException.class,
-              () -> {
-                childAllocator2.close();
-              });
+      Exception exception = assertThrows(IllegalStateException.class, 
childAllocator2::close);
       String exMessage = exception.getMessage();
       assertTrue(exMessage.contains("Memory leaked: (256)"));
 
-      exception =
-          assertThrows(
-              IllegalStateException.class,
-              () -> {
-                childAllocator1.close();
-              });
+      exception = assertThrows(IllegalStateException.class, 
childAllocator1::close);
       exMessage = exception.getMessage();
       assertTrue(exMessage.contains("Memory leaked: (256)"));
     }
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBoundaryChecking.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBoundaryChecking.java
index 823fa5e3da..7d4d1e7b67 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBoundaryChecking.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestBoundaryChecking.java
@@ -16,10 +16,12 @@
  */
 package org.apache.arrow.memory;
 
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 import java.lang.reflect.Field;
 import java.net.URLClassLoader;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for evaluating the value of {@link 
BoundsChecking#BOUNDS_CHECKING_ENABLED}. */
 public class TestBoundaryChecking {
@@ -61,7 +63,7 @@ public class TestBoundaryChecking {
     ClassLoader classLoader = copyClassLoader();
     if (classLoader != null) {
       boolean boundsCheckingEnabled = getFlagValue(classLoader);
-      Assert.assertTrue(boundsCheckingEnabled);
+      assertTrue(boundsCheckingEnabled);
     }
   }
 
@@ -78,7 +80,7 @@ public class TestBoundaryChecking {
     ClassLoader classLoader = copyClassLoader();
     if (classLoader != null) {
       boolean boundsCheckingEnabled = getFlagValue(classLoader);
-      Assert.assertFalse(boundsCheckingEnabled);
+      assertFalse(boundsCheckingEnabled);
     }
 
     // restore system property
@@ -103,7 +105,7 @@ public class TestBoundaryChecking {
     ClassLoader classLoader = copyClassLoader();
     if (classLoader != null) {
       boolean boundsCheckingEnabled = getFlagValue(classLoader);
-      Assert.assertFalse(boundsCheckingEnabled);
+      assertFalse(boundsCheckingEnabled);
     }
 
     // restore system property
@@ -132,7 +134,7 @@ public class TestBoundaryChecking {
     ClassLoader classLoader = copyClassLoader();
     if (classLoader != null) {
       boolean boundsCheckingEnabled = getFlagValue(classLoader);
-      Assert.assertFalse(boundsCheckingEnabled);
+      assertFalse(boundsCheckingEnabled);
     }
 
     // restore system property
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestForeignAllocation.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestForeignAllocation.java
index 301faed796..162bbbcbe9 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestForeignAllocation.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestForeignAllocation.java
@@ -16,25 +16,26 @@
  */
 package org.apache.arrow.memory;
 
-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.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.arrow.memory.util.MemoryUtil;
-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;
 
 public class TestForeignAllocation {
   BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void before() {
     allocator = new RootAllocator();
   }
 
-  @After
+  @AfterEach
   public void after() {
     allocator.close();
   }
@@ -82,25 +83,28 @@ public class TestForeignAllocation {
     assertEquals(16, listener.getTotalMem());
   }
 
-  @Test(expected = OutOfMemoryException.class)
+  @Test
   public void wrapForeignAllocationFailedWithAllocationListener() {
-    final long bufferSize = 16;
-    final long limit = bufferSize - 1;
-
-    final CountingAllocationListener listener = new 
CountingAllocationListener();
-    try (BufferAllocator listenedAllocator =
-        allocator.newChildAllocator("child", listener, 0L, limit)) {
-      UnsafeForeignAllocation allocation = new 
UnsafeForeignAllocation(bufferSize);
-      try {
-        assertEquals(0, listenedAllocator.getAllocatedMemory());
-        ArrowBuf buf = listenedAllocator.wrapForeignAllocation(allocation);
-        assertEquals(bufferSize, buf.capacity());
-        buf.close();
-        assertTrue(allocation.released);
-      } finally {
-        allocation.release0();
-      }
-    }
+    assertThrows(
+        OutOfMemoryException.class,
+        () -> {
+          final long bufferSize = 16;
+          final long limit = bufferSize - 1;
+          final CountingAllocationListener listener = new 
CountingAllocationListener();
+          try (BufferAllocator listenedAllocator =
+              allocator.newChildAllocator("child", listener, 0L, limit)) {
+            UnsafeForeignAllocation allocation = new 
UnsafeForeignAllocation(bufferSize);
+            try {
+              assertEquals(0, listenedAllocator.getAllocatedMemory());
+              ArrowBuf buf = 
listenedAllocator.wrapForeignAllocation(allocation);
+              assertEquals(bufferSize, buf.capacity());
+              buf.close();
+              assertTrue(allocation.released);
+            } finally {
+              allocation.release0();
+            }
+          }
+        });
   }
 
   @Test
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
index 5404ea08bd..5fbf6a55dc 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestLowCostIdentityHashMap.java
@@ -16,18 +16,19 @@
  */
 package org.apache.arrow.memory;
 
-import static junit.framework.TestCase.assertNotNull;
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** To test simplified implementation of IdentityHashMap. */
 public class TestLowCostIdentityHashMap {
 
   @Test
-  public void testIdentityHashMap() throws Exception {
+  public void testIdentityHashMap() {
     LowCostIdentityHashMap<String, StringWithKey> hashMap = new 
LowCostIdentityHashMap<>();
 
     StringWithKey obj1 = new StringWithKey("s1key", "s1value");
@@ -52,7 +53,7 @@ public class TestLowCostIdentityHashMap {
 
     assertEquals(3, hashMap.size());
 
-    assertTrue(!hashMap.isEmpty());
+    assertFalse(hashMap.isEmpty());
 
     StringWithKey nextValue = hashMap.getNextValue();
 
@@ -86,7 +87,7 @@ public class TestLowCostIdentityHashMap {
   }
 
   @Test
-  public void testLargeMap() throws Exception {
+  public void testLargeMap() {
     LowCostIdentityHashMap<String, StringWithKey> hashMap = new 
LowCostIdentityHashMap<>();
 
     String[] keys = new String[200];
@@ -127,7 +128,7 @@ public class TestLowCostIdentityHashMap {
       if (i % 4 == 0) {
         StringWithKey returnObj = hashMap.remove(keys[i]);
         assertNotNull(returnObj);
-        assertTrue(!hashMap.containsKey(keys[i]));
+        assertFalse(hashMap.containsKey(keys[i]));
       }
       StringWithKey obj = new StringWithKey(keys[100 + i], "s" + (100 + i) + 
"value");
       StringWithKey retObj = hashMap.put(obj);
@@ -140,7 +141,7 @@ public class TestLowCostIdentityHashMap {
       assertNotNull(retObj);
       hashMap.remove(retObj.getKey());
     }
-    assertTrue(!hashMap.isEmpty());
+    assertFalse(hashMap.isEmpty());
     assertEquals(75, hashMap.size());
     hashMap.clear();
     assertTrue(hashMap.isEmpty());
@@ -148,8 +149,8 @@ public class TestLowCostIdentityHashMap {
 
   private static class StringWithKey implements ValueWithKeyIncluded<String> {
 
-    private String myValue;
-    private String myKey;
+    private final String myValue;
+    private final String myKey;
 
     StringWithKey(String myKey, String myValue) {
       this.myKey = myKey;
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestOpens.java 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestOpens.java
index f76af3c022..756aa29197 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestOpens.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestOpens.java
@@ -19,7 +19,7 @@ package org.apache.arrow.memory;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestOpens {
   /** Instantiating the RootAllocator should poke MemoryUtil and fail. */
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestArrowBufPointer.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestArrowBufPointer.java
index 365cffa6f7..bb94ed71a8 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestArrowBufPointer.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestArrowBufPointer.java
@@ -16,19 +16,19 @@
  */
 package org.apache.arrow.memory.util;
 
-import static junit.framework.TestCase.assertEquals;
-import static junit.framework.TestCase.assertNotSame;
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.memory.util.hash.ArrowBufHasher;
 import org.apache.arrow.memory.util.hash.SimpleHasher;
-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 ArrowBufPointer}. */
 public class TestArrowBufPointer {
@@ -37,12 +37,12 @@ public class TestArrowBufPointer {
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
@@ -58,11 +58,11 @@ public class TestArrowBufPointer {
 
       ArrowBufPointer ptr1 = new ArrowBufPointer(null, 0, 100);
       ArrowBufPointer ptr2 = new ArrowBufPointer(null, 100, 5032);
-      assertTrue(ptr1.equals(ptr2));
+      assertEquals(ptr1, ptr2);
       for (int i = 0; i < BUFFER_LENGTH / 4; i++) {
         ptr1.set(buf1, i * 4L, 4);
         ptr2.set(buf2, i * 4L, 4);
-        assertTrue(ptr1.equals(ptr2));
+        assertEquals(ptr1, ptr2);
       }
     }
   }
@@ -144,7 +144,7 @@ public class TestArrowBufPointer {
       ArrowBufPointer pointer2 = new ArrowBufPointer(buf, 0, 10, new 
CounterHasher());
 
       // the two pointers cannot be equal, since they have different hashers
-      assertFalse(pointer1.equals(pointer2));
+      assertNotEquals(pointer1, pointer2);
     }
   }
 
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestByteFunctionHelpers.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestByteFunctionHelpers.java
index 65409abb45..757bc85b47 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestByteFunctionHelpers.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestByteFunctionHelpers.java
@@ -16,15 +16,15 @@
  */
 package org.apache.arrow.memory.util;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.nio.charset.StandardCharsets;
 import org.apache.arrow.memory.ArrowBuf;
 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;
 
 public class TestByteFunctionHelpers {
 
@@ -32,12 +32,12 @@ public class TestByteFunctionHelpers {
 
   private static final int SIZE = 100;
 
-  @Before
+  @BeforeEach
   public void init() {
     allocator = new RootAllocator(Long.MAX_VALUE);
   }
 
-  @After
+  @AfterEach
   public void terminate() throws Exception {
     allocator.close();
   }
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestLargeMemoryUtil.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestLargeMemoryUtil.java
index 575243ef69..ae72e67143 100755
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestLargeMemoryUtil.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/TestLargeMemoryUtil.java
@@ -16,12 +16,14 @@
  */
 package org.apache.arrow.memory.util;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URLClassLoader;
-import org.junit.Assert;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 public class TestLargeMemoryUtil {
 
@@ -56,12 +58,9 @@ public class TestLargeMemoryUtil {
   private void checkExpectedOverflow(ClassLoader classLoader, long value) {
     InvocationTargetException ex =
         Assertions.assertThrows(
-            InvocationTargetException.class,
-            () -> {
-              checkedCastToInt(classLoader, value);
-            });
-    Assert.assertTrue(ex.getCause() instanceof ArithmeticException);
-    Assert.assertEquals("integer overflow", ex.getCause().getMessage());
+            InvocationTargetException.class, () -> 
checkedCastToInt(classLoader, value));
+    assertInstanceOf(ArithmeticException.class, ex.getCause());
+    assertEquals("integer overflow", ex.getCause().getMessage());
   }
 
   @Test
@@ -71,7 +70,7 @@ public class TestLargeMemoryUtil {
     try {
       ClassLoader classLoader = copyClassLoader();
       if (classLoader != null) {
-        Assert.assertEquals(Integer.MAX_VALUE, checkedCastToInt(classLoader, 
Integer.MAX_VALUE));
+        assertEquals(Integer.MAX_VALUE, checkedCastToInt(classLoader, 
Integer.MAX_VALUE));
         checkExpectedOverflow(classLoader, Integer.MAX_VALUE + 1L);
         checkExpectedOverflow(classLoader, Integer.MIN_VALUE - 1L);
       }
@@ -92,11 +91,9 @@ public class TestLargeMemoryUtil {
     try {
       ClassLoader classLoader = copyClassLoader();
       if (classLoader != null) {
-        Assert.assertEquals(Integer.MAX_VALUE, checkedCastToInt(classLoader, 
Integer.MAX_VALUE));
-        Assert.assertEquals(
-            Integer.MIN_VALUE, checkedCastToInt(classLoader, Integer.MAX_VALUE 
+ 1L));
-        Assert.assertEquals(
-            Integer.MAX_VALUE, checkedCastToInt(classLoader, Integer.MIN_VALUE 
- 1L));
+        assertEquals(Integer.MAX_VALUE, checkedCastToInt(classLoader, 
Integer.MAX_VALUE));
+        assertEquals(Integer.MIN_VALUE, checkedCastToInt(classLoader, 
Integer.MAX_VALUE + 1L));
+        assertEquals(Integer.MAX_VALUE, checkedCastToInt(classLoader, 
Integer.MIN_VALUE - 1L));
       }
     } finally {
       // restore system property
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/hash/TestArrowBufHasher.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/hash/TestArrowBufHasher.java
index 8d7fa0b44e..c261fd090b 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/hash/TestArrowBufHasher.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/memory/util/hash/TestArrowBufHasher.java
@@ -16,48 +16,41 @@
  */
 package org.apache.arrow.memory.util.hash;
 
-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 static org.junit.jupiter.api.Assertions.assertThrows;
 
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collection;
+import java.util.stream.Stream;
 import org.apache.arrow.memory.ArrowBuf;
 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.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 ArrowBufHasher} and its subclasses. */
-@RunWith(Parameterized.class)
 public class TestArrowBufHasher {
 
   private final int BUFFER_LENGTH = 1024;
 
   private BufferAllocator allocator;
 
-  private ArrowBufHasher hasher;
-
-  public TestArrowBufHasher(String name, ArrowBufHasher hasher) {
-    this.hasher = hasher;
-  }
-
-  @Before
+  @BeforeEach
   public void prepare() {
     allocator = new RootAllocator(1024 * 1024);
   }
 
-  @After
+  @AfterEach
   public void shutdown() {
     allocator.close();
   }
 
-  @Test
-  public void testHasher() {
+  @ParameterizedTest(name = "hasher = {0}")
+  @MethodSource("getHasher")
+  void testHasher(String name, ArrowBufHasher hasher) {
     try (ArrowBuf buf1 = allocator.buffer(BUFFER_LENGTH);
         ArrowBuf buf2 = allocator.buffer(BUFFER_LENGTH)) {
       // prepare data
@@ -66,77 +59,73 @@ public class TestArrowBufHasher {
         buf2.setFloat(i * 4L, i / 10.0f);
       }
 
-      verifyHashCodesEqual(buf1, 0, 100, buf2, 0, 100);
-      verifyHashCodesEqual(buf1, 1, 5, buf2, 1, 5);
-      verifyHashCodesEqual(buf1, 10, 17, buf2, 10, 17);
-      verifyHashCodesEqual(buf1, 33, 25, buf2, 33, 25);
-      verifyHashCodesEqual(buf1, 22, 22, buf2, 22, 22);
-      verifyHashCodesEqual(buf1, 123, 333, buf2, 123, 333);
-      verifyHashCodesEqual(buf1, 374, 1, buf2, 374, 1);
-      verifyHashCodesEqual(buf1, 11, 0, buf2, 11, 0);
-      verifyHashCodesEqual(buf1, 75, 25, buf2, 75, 25);
-      verifyHashCodesEqual(buf1, 0, 1024, buf2, 0, 1024);
+      verifyHashCodesEqual(hasher, buf1, 0, 100, buf2, 0, 100);
+      verifyHashCodesEqual(hasher, buf1, 1, 5, buf2, 1, 5);
+      verifyHashCodesEqual(hasher, buf1, 10, 17, buf2, 10, 17);
+      verifyHashCodesEqual(hasher, buf1, 33, 25, buf2, 33, 25);
+      verifyHashCodesEqual(hasher, buf1, 22, 22, buf2, 22, 22);
+      verifyHashCodesEqual(hasher, buf1, 123, 333, buf2, 123, 333);
+      verifyHashCodesEqual(hasher, buf1, 374, 1, buf2, 374, 1);
+      verifyHashCodesEqual(hasher, buf1, 11, 0, buf2, 11, 0);
+      verifyHashCodesEqual(hasher, buf1, 75, 25, buf2, 75, 25);
+      verifyHashCodesEqual(hasher, buf1, 0, 1024, buf2, 0, 1024);
     }
   }
 
   private void verifyHashCodesEqual(
-      ArrowBuf buf1, int offset1, int length1, ArrowBuf buf2, int offset2, int 
length2) {
+      ArrowBufHasher hasher,
+      ArrowBuf buf1,
+      int offset1,
+      int length1,
+      ArrowBuf buf2,
+      int offset2,
+      int length2) {
     int hashCode1 = hasher.hashCode(buf1, offset1, length1);
     int hashCode2 = hasher.hashCode(buf2, offset2, length2);
     assertEquals(hashCode1, hashCode2);
   }
 
-  @Test
-  public void testHasherNegative() {
+  @ParameterizedTest(name = "hasher = {0}")
+  @MethodSource("getHasher")
+  public void testHasherNegative(String name, ArrowBufHasher hasher) {
     try (ArrowBuf buf = allocator.buffer(BUFFER_LENGTH)) {
       // prepare data
       for (int i = 0; i < BUFFER_LENGTH / 4; i++) {
         buf.setFloat(i * 4L, i / 10.0f);
       }
 
-      assertThrows(
-          IllegalArgumentException.class,
-          () -> {
-            hasher.hashCode(buf, 0, -1);
-          });
-
-      assertThrows(
-          IndexOutOfBoundsException.class,
-          () -> {
-            hasher.hashCode(buf, 0, 1028);
-          });
-
-      assertThrows(
-          IndexOutOfBoundsException.class,
-          () -> {
-            hasher.hashCode(buf, 500, 1000);
-          });
+      assertThrows(IllegalArgumentException.class, () -> hasher.hashCode(buf, 
0, -1));
+
+      assertThrows(IndexOutOfBoundsException.class, () -> hasher.hashCode(buf, 
0, 1028));
+
+      assertThrows(IndexOutOfBoundsException.class, () -> hasher.hashCode(buf, 
500, 1000));
     }
   }
 
-  @Test
-  public void testHasherLessThanInt() {
+  @ParameterizedTest(name = "hasher = {0}")
+  @MethodSource("getHasher")
+  public void testHasherLessThanInt(String name, ArrowBufHasher hasher) {
     try (ArrowBuf buf1 = allocator.buffer(4);
         ArrowBuf buf2 = allocator.buffer(4)) {
       buf1.writeBytes("foo1".getBytes(StandardCharsets.UTF_8));
       buf2.writeBytes("bar2".getBytes(StandardCharsets.UTF_8));
 
       for (int i = 1; i <= 4; i++) {
-        verifyHashCodeNotEqual(buf1, i, buf2, i);
+        verifyHashCodeNotEqual(hasher, buf1, i, buf2, i);
       }
     }
   }
 
-  private void verifyHashCodeNotEqual(ArrowBuf buf1, int length1, ArrowBuf 
buf2, int length2) {
+  private void verifyHashCodeNotEqual(
+      ArrowBufHasher hasher, ArrowBuf buf1, int length1, ArrowBuf buf2, int 
length2) {
     int hashCode1 = hasher.hashCode(buf1, 0, length1);
     int hashCode2 = hasher.hashCode(buf2, 0, length2);
     assertNotEquals(hashCode1, hashCode2);
   }
 
-  @Parameterized.Parameters(name = "hasher = {0}")
-  public static Collection<Object[]> getHasher() {
-    return Arrays.asList(
-        new Object[] {SimpleHasher.class.getSimpleName(), 
SimpleHasher.INSTANCE},
-        new Object[] {MurmurHasher.class.getSimpleName(), new MurmurHasher()});
+  private static Stream<Arguments> getHasher() {
+    return Stream.of(
+        Arguments.of(SimpleHasher.class.getSimpleName(), 
SimpleHasher.INSTANCE),
+        Arguments.of(MurmurHasher.class.getSimpleName(), new MurmurHasher()));
   }
 }
diff --git 
a/java/memory/memory-core/src/test/java/org/apache/arrow/util/TestCollections2.java
 
b/java/memory/memory-core/src/test/java/org/apache/arrow/util/TestCollections2.java
index 8e57e4fdb1..20052e42b3 100644
--- 
a/java/memory/memory-core/src/test/java/org/apache/arrow/util/TestCollections2.java
+++ 
b/java/memory/memory-core/src/test/java/org/apache/arrow/util/TestCollections2.java
@@ -16,15 +16,16 @@
  */
 package org.apache.arrow.util;
 
-import static org.junit.Assert.fail;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Tests for {@code Collections2} class. */
 public class TestCollections2 {
@@ -72,6 +73,6 @@ public class TestCollections2 {
     iterator.next();
 
     assertEquals("[bar, baz]", Collections2.toString(iterator));
-    assertEquals(false, iterator.hasNext());
+    assertFalse(iterator.hasNext());
   }
 }
diff --git 
a/java/memory/memory-netty-buffer-patch/src/test/java/io/netty/buffer/TestUnsafeDirectLittleEndian.java
 
b/java/memory/memory-netty-buffer-patch/src/test/java/io/netty/buffer/TestUnsafeDirectLittleEndian.java
index 0277c76c75..e548bbf0c2 100644
--- 
a/java/memory/memory-netty-buffer-patch/src/test/java/io/netty/buffer/TestUnsafeDirectLittleEndian.java
+++ 
b/java/memory/memory-netty-buffer-patch/src/test/java/io/netty/buffer/TestUnsafeDirectLittleEndian.java
@@ -16,13 +16,13 @@
  */
 package io.netty.buffer;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestUnsafeDirectLittleEndian {
 
@@ -30,20 +30,7 @@ public class TestUnsafeDirectLittleEndian {
   @SuppressWarnings("CatchAndPrintStackTrace")
   public void testPrimitiveGetSet() {
     ByteBuf byteBuf = Unpooled.directBuffer(64);
-    UnsafeDirectLittleEndian unsafeDirect = new UnsafeDirectLittleEndian(new 
LargeBuffer(byteBuf));
-
-    unsafeDirect.setByte(0, Byte.MAX_VALUE);
-    unsafeDirect.setByte(1, -1); // 0xFF
-    unsafeDirect.setShort(2, Short.MAX_VALUE);
-    unsafeDirect.setShort(4, -2); // 0xFFFE
-    unsafeDirect.setInt(8, Integer.MAX_VALUE);
-    unsafeDirect.setInt(12, -66052); // 0xFFFE FDFC
-    unsafeDirect.setLong(16, Long.MAX_VALUE);
-    unsafeDirect.setLong(24, -4295098372L); // 0xFFFF FFFE FFFD FFFC
-    unsafeDirect.setFloat(32, 1.23F);
-    unsafeDirect.setFloat(36, -1.23F);
-    unsafeDirect.setDouble(40, 1.234567D);
-    unsafeDirect.setDouble(48, -1.234567D);
+    UnsafeDirectLittleEndian unsafeDirect = 
getUnsafeDirectLittleEndian(byteBuf);
 
     assertEquals(Byte.MAX_VALUE, unsafeDirect.getByte(0));
     assertEquals(-1, unsafeDirect.getByte(1));
@@ -70,4 +57,22 @@ public class TestUnsafeDirectLittleEndian {
       e.printStackTrace();
     }
   }
+
+  private static UnsafeDirectLittleEndian getUnsafeDirectLittleEndian(ByteBuf 
byteBuf) {
+    UnsafeDirectLittleEndian unsafeDirect = new UnsafeDirectLittleEndian(new 
LargeBuffer(byteBuf));
+
+    unsafeDirect.setByte(0, Byte.MAX_VALUE);
+    unsafeDirect.setByte(1, -1); // 0xFF
+    unsafeDirect.setShort(2, Short.MAX_VALUE);
+    unsafeDirect.setShort(4, -2); // 0xFFFE
+    unsafeDirect.setInt(8, Integer.MAX_VALUE);
+    unsafeDirect.setInt(12, -66052); // 0xFFFE FDFC
+    unsafeDirect.setLong(16, Long.MAX_VALUE);
+    unsafeDirect.setLong(24, -4295098372L); // 0xFFFF FFFE FFFD FFFC
+    unsafeDirect.setFloat(32, 1.23F);
+    unsafeDirect.setFloat(36, -1.23F);
+    unsafeDirect.setDouble(40, 1.234567D);
+    unsafeDirect.setDouble(48, -1.234567D);
+    return unsafeDirect;
+  }
 }
diff --git 
a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java
 
b/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java
index e3d1f403f8..45aa0f38a5 100644
--- 
a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java
+++ 
b/java/memory/memory-netty/src/test/java/io/netty/buffer/TestExpandableByteBuf.java
@@ -16,42 +16,43 @@
  */
 package io.netty.buffer;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestExpandableByteBuf {
 
   @Test
   public void testCapacity() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       ByteBuf newByteBuf = expandableByteBuf.capacity(31);
       int capacity = newByteBuf.capacity();
-      Assert.assertEquals(32, capacity);
+      assertEquals(32, capacity);
     }
   }
 
   @Test
   public void testCapacity1() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       ByteBuf newByteBuf = expandableByteBuf.capacity(32);
       int capacity = newByteBuf.capacity();
-      Assert.assertEquals(32, capacity);
+      assertEquals(32, capacity);
     }
   }
 
   @Test
   public void testSetAndGetIntValues() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       int[] intVals =
@@ -66,8 +67,8 @@ public class TestExpandableByteBuf {
           };
       for (int intValue : intVals) {
         expandableByteBuf.setInt(0, intValue);
-        Assert.assertEquals(expandableByteBuf.getInt(0), intValue);
-        Assert.assertEquals(expandableByteBuf.getIntLE(0), 
Integer.reverseBytes(intValue));
+        assertEquals(expandableByteBuf.getInt(0), intValue);
+        assertEquals(expandableByteBuf.getIntLE(0), 
Integer.reverseBytes(intValue));
       }
     }
   }
@@ -75,14 +76,14 @@ public class TestExpandableByteBuf {
   @Test
   public void testSetAndGetLongValues() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       long[] longVals = new long[] {Long.MIN_VALUE, 0, Long.MAX_VALUE};
       for (long longValue : longVals) {
         expandableByteBuf.setLong(0, longValue);
-        Assert.assertEquals(expandableByteBuf.getLong(0), longValue);
-        Assert.assertEquals(expandableByteBuf.getLongLE(0), 
Long.reverseBytes(longValue));
+        assertEquals(expandableByteBuf.getLong(0), longValue);
+        assertEquals(expandableByteBuf.getLongLE(0), 
Long.reverseBytes(longValue));
       }
     }
   }
@@ -90,14 +91,14 @@ public class TestExpandableByteBuf {
   @Test
   public void testSetAndGetShortValues() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       short[] shortVals = new short[] {Short.MIN_VALUE, 0, Short.MAX_VALUE};
       for (short shortValue : shortVals) {
         expandableByteBuf.setShort(0, shortValue);
-        Assert.assertEquals(expandableByteBuf.getShort(0), shortValue);
-        Assert.assertEquals(expandableByteBuf.getShortLE(0), 
Short.reverseBytes(shortValue));
+        assertEquals(expandableByteBuf.getShort(0), shortValue);
+        assertEquals(expandableByteBuf.getShortLE(0), 
Short.reverseBytes(shortValue));
       }
     }
   }
@@ -105,13 +106,13 @@ public class TestExpandableByteBuf {
   @Test
   public void testSetAndGetByteValues() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf srcByteBuf = NettyArrowBuf.unwrapBuffer(buf);
       ExpandableByteBuf expandableByteBuf = new ExpandableByteBuf(srcByteBuf, 
allocator);
       byte[] byteVals = new byte[] {Byte.MIN_VALUE, 0, Byte.MAX_VALUE};
       for (short byteValue : byteVals) {
         expandableByteBuf.setByte(0, byteValue);
-        Assert.assertEquals(expandableByteBuf.getByte(0), byteValue);
+        assertEquals(expandableByteBuf.getByte(0), byteValue);
       }
     }
   }
diff --git 
a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java 
b/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java
index 9c6197b9be..19d793d0fc 100644
--- 
a/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java
+++ 
b/java/memory/memory-netty/src/test/java/io/netty/buffer/TestNettyArrowBuf.java
@@ -16,60 +16,62 @@
  */
 package io.netty.buffer;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
 import java.nio.ByteBuffer;
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
 import org.apache.arrow.memory.patch.ArrowByteBufAllocator;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestNettyArrowBuf {
 
   @Test
   public void testSliceWithoutArgs() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf nettyBuf = NettyArrowBuf.unwrapBuffer(buf);
       nettyBuf.writerIndex(20);
       nettyBuf.readerIndex(10);
       NettyArrowBuf slicedBuffer = nettyBuf.slice();
       int readableBytes = slicedBuffer.readableBytes();
-      Assert.assertEquals(10, readableBytes);
+      assertEquals(10, readableBytes);
     }
   }
 
   @Test
   public void testNioBuffer() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf nettyBuf = NettyArrowBuf.unwrapBuffer(buf);
       ByteBuffer byteBuffer = nettyBuf.nioBuffer(4, 6);
       // Nio Buffers should always be 0 indexed
-      Assert.assertEquals(0, byteBuffer.position());
-      Assert.assertEquals(6, byteBuffer.limit());
+      assertEquals(0, byteBuffer.position());
+      assertEquals(6, byteBuffer.limit());
       // Underlying buffer has size 32 excluding 4 should have capacity of 28.
-      Assert.assertEquals(28, byteBuffer.capacity());
+      assertEquals(28, byteBuffer.capacity());
     }
   }
 
   @Test
   public void testInternalNioBuffer() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf nettyBuf = NettyArrowBuf.unwrapBuffer(buf);
       ByteBuffer byteBuffer = nettyBuf.internalNioBuffer(4, 6);
-      Assert.assertEquals(0, byteBuffer.position());
-      Assert.assertEquals(6, byteBuffer.limit());
+      assertEquals(0, byteBuffer.position());
+      assertEquals(6, byteBuffer.limit());
       // Underlying buffer has size 32 excluding 4 should have capacity of 28.
-      Assert.assertEquals(28, byteBuffer.capacity());
+      assertEquals(28, byteBuffer.capacity());
     }
   }
 
   @Test
   public void testSetLEValues() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf nettyBuf = NettyArrowBuf.unwrapBuffer(buf);
       int[] intVals =
           new int[] {
@@ -83,19 +85,19 @@ public class TestNettyArrowBuf {
           };
       for (int intValue : intVals) {
         nettyBuf._setInt(0, intValue);
-        Assert.assertEquals(nettyBuf._getIntLE(0), 
Integer.reverseBytes(intValue));
+        assertEquals(nettyBuf._getIntLE(0), Integer.reverseBytes(intValue));
       }
 
       long[] longVals = new long[] {Long.MIN_VALUE, 0, Long.MAX_VALUE};
       for (long longValue : longVals) {
         nettyBuf._setLong(0, longValue);
-        Assert.assertEquals(nettyBuf._getLongLE(0), 
Long.reverseBytes(longValue));
+        assertEquals(nettyBuf._getLongLE(0), Long.reverseBytes(longValue));
       }
 
       short[] shortVals = new short[] {Short.MIN_VALUE, 0, Short.MAX_VALUE};
       for (short shortValue : shortVals) {
         nettyBuf._setShort(0, shortValue);
-        Assert.assertEquals(nettyBuf._getShortLE(0), 
Short.reverseBytes(shortValue));
+        assertEquals(nettyBuf._getShortLE(0), Short.reverseBytes(shortValue));
       }
     }
   }
@@ -104,7 +106,7 @@ public class TestNettyArrowBuf {
   public void testSetCompositeBuffer() {
     try (BufferAllocator allocator = new RootAllocator(128);
         ArrowBuf buf = allocator.buffer(20);
-        NettyArrowBuf buf2 = NettyArrowBuf.unwrapBuffer(allocator.buffer(20)); 
) {
+        NettyArrowBuf buf2 = NettyArrowBuf.unwrapBuffer(allocator.buffer(20))) 
{
       CompositeByteBuf byteBufs =
           new CompositeByteBuf(new ArrowByteBufAllocator(allocator), true, 1);
       int expected = 4;
@@ -113,14 +115,14 @@ public class TestNettyArrowBuf {
       byteBufs.addComponent(true, buf2);
       NettyArrowBuf.unwrapBuffer(buf).setBytes(0, byteBufs, 4);
       int actual = buf.getInt(0);
-      Assert.assertEquals(expected, actual);
+      assertEquals(expected, actual);
     }
   }
 
   @Test
   public void testGetCompositeBuffer() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       CompositeByteBuf byteBufs =
           new CompositeByteBuf(new ArrowByteBufAllocator(allocator), true, 1);
       int expected = 4;
@@ -132,7 +134,7 @@ public class TestNettyArrowBuf {
       byteBufs.capacity(20);
       NettyArrowBuf.unwrapBuffer(buf).getBytes(0, byteBufs, 4);
       int actual = byteBufs.getInt(0);
-      Assert.assertEquals(expected, actual);
+      assertEquals(expected, actual);
       byteBufs.component(0).release();
     }
   }
@@ -140,10 +142,10 @@ public class TestNettyArrowBuf {
   @Test
   public void testUnwrapReturnsNull() {
     try (BufferAllocator allocator = new RootAllocator(128);
-        ArrowBuf buf = allocator.buffer(20); ) {
+        ArrowBuf buf = allocator.buffer(20)) {
       NettyArrowBuf nettyBuf = NettyArrowBuf.unwrapBuffer(buf);
       // NettyArrowBuf cannot be unwrapped, so unwrap() should return null per 
the Netty ByteBuf API
-      Assert.assertNull(nettyBuf.unwrap());
+      assertNull(nettyBuf.unwrap());
     }
   }
 }
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/ITTestLargeArrowBuf.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/ITTestLargeArrowBuf.java
index 3997615c88..1029ed7384 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/ITTestLargeArrowBuf.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/ITTestLargeArrowBuf.java
@@ -16,12 +16,12 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestAllocationManagerNetty.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestAllocationManagerNetty.java
index 40c95f0e66..655129909a 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestAllocationManagerNetty.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestAllocationManagerNetty.java
@@ -16,11 +16,11 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.arrow.memory.AllocationManager;
 import org.apache.arrow.memory.DefaultAllocationManagerOption;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link AllocationManager}. */
 public class TestAllocationManagerNetty {
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEmptyArrowBuf.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEmptyArrowBuf.java
index e01aa04b93..3ce0705b4e 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEmptyArrowBuf.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEmptyArrowBuf.java
@@ -16,28 +16,29 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import io.netty.buffer.PooledByteBufAllocatorL;
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.ReferenceManager;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 public class TestEmptyArrowBuf {
 
   private static final int MAX_ALLOCATION = 8 * 1024;
   private static RootAllocator allocator;
 
-  @BeforeClass
+  @BeforeAll
   public static void beforeClass() {
     allocator = new RootAllocator(MAX_ALLOCATION);
   }
 
   /** Ensure the allocator is closed. */
-  @AfterClass
+  @AfterAll
   public static void afterClass() {
     if (allocator != null) {
       allocator.close();
@@ -75,8 +76,8 @@ public class TestEmptyArrowBuf {
     assertEquals(0, buf.getActualMemoryConsumed());
     assertEquals(0, buf.getReferenceManager().getSize());
     assertEquals(0, buf.getReferenceManager().getAccountedSize());
-    assertEquals(false, buf.getReferenceManager().release());
-    assertEquals(false, buf.getReferenceManager().release(2));
+    assertFalse(buf.getReferenceManager().release());
+    assertFalse(buf.getReferenceManager().release(2));
     assertEquals(0, buf.getReferenceManager().getAllocator().getLimit());
     assertEquals(
         buf, buf.getReferenceManager().transferOwnership(buf, 
allocator).getTransferredBuffer());
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEndianness.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEndianness.java
index 2602ada493..eb5c3a43ab 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEndianness.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestEndianness.java
@@ -16,14 +16,14 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.NettyArrowBuf;
 import java.nio.ByteOrder;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class TestEndianness {
 
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocationManager.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocationManager.java
index 6f53a6d0fa..2144b2d930 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocationManager.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocationManager.java
@@ -16,17 +16,17 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
 
 import org.apache.arrow.memory.AllocationManager;
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.BufferLedger;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link NettyAllocationManager}. */
 public class TestNettyAllocationManager {
@@ -72,12 +72,12 @@ public class TestNettyAllocationManager {
     try (RootAllocator allocator = createCustomizedAllocator();
         ArrowBuf buffer = allocator.buffer(bufSize)) {
 
-      assertTrue(buffer.getReferenceManager() instanceof BufferLedger);
+      assertInstanceOf(BufferLedger.class, buffer.getReferenceManager());
       BufferLedger bufferLedger = (BufferLedger) buffer.getReferenceManager();
 
       // make sure we are using netty allocation manager
       AllocationManager allocMgr = bufferLedger.getAllocationManager();
-      assertTrue(allocMgr instanceof NettyAllocationManager);
+      assertInstanceOf(NettyAllocationManager.class, allocMgr);
       NettyAllocationManager nettyMgr = (NettyAllocationManager) allocMgr;
 
       // for the small buffer allocation strategy, the chunk is not null
@@ -93,12 +93,12 @@ public class TestNettyAllocationManager {
     final long bufSize = CUSTOMIZED_ALLOCATION_CUTOFF_VALUE + 1024L;
     try (RootAllocator allocator = createCustomizedAllocator();
         ArrowBuf buffer = allocator.buffer(bufSize)) {
-      assertTrue(buffer.getReferenceManager() instanceof BufferLedger);
+      assertInstanceOf(BufferLedger.class, buffer.getReferenceManager());
       BufferLedger bufferLedger = (BufferLedger) buffer.getReferenceManager();
 
       // make sure we are using netty allocation manager
       AllocationManager allocMgr = bufferLedger.getAllocationManager();
-      assertTrue(allocMgr instanceof NettyAllocationManager);
+      assertInstanceOf(NettyAllocationManager.class, allocMgr);
       NettyAllocationManager nettyMgr = (NettyAllocationManager) allocMgr;
 
       // for the large buffer allocation strategy, the chunk is null
diff --git 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
index d631ec60db..5be42ecb08 100644
--- 
a/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
+++ 
b/java/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
@@ -16,7 +16,7 @@
  */
 package org.apache.arrow.memory.netty;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.Logger;
@@ -27,7 +27,7 @@ import java.util.Collections;
 import java.util.stream.Collectors;
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.ReferenceManager;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.slf4j.LoggerFactory;
 
 /** Test netty allocators. */
@@ -75,11 +75,11 @@ public class TestNettyAllocator {
       }
       synchronized (memoryLogsAppender.list) {
         assertTrue(
+            result,
             "Log messages are:\n"
                 + memoryLogsAppender.list.stream()
                     .map(ILoggingEvent::toString)
-                    .collect(Collectors.joining("\n")),
-            result);
+                    .collect(Collectors.joining("\n")));
       }
 
     } finally {
diff --git 
a/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestAllocationManagerUnsafe.java
 
b/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestAllocationManagerUnsafe.java
index a6395b952a..0187d63046 100644
--- 
a/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestAllocationManagerUnsafe.java
+++ 
b/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestAllocationManagerUnsafe.java
@@ -16,11 +16,11 @@
  */
 package org.apache.arrow.memory.unsafe;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import org.apache.arrow.memory.AllocationManager;
 import org.apache.arrow.memory.DefaultAllocationManagerOption;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link AllocationManager}. */
 public class TestAllocationManagerUnsafe {
diff --git 
a/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestUnsafeAllocationManager.java
 
b/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestUnsafeAllocationManager.java
index cb03845e3a..947570f76b 100644
--- 
a/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestUnsafeAllocationManager.java
+++ 
b/java/memory/memory-unsafe/src/test/java/org/apache/arrow/memory/unsafe/TestUnsafeAllocationManager.java
@@ -16,15 +16,15 @@
  */
 package org.apache.arrow.memory.unsafe;
 
-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.assertInstanceOf;
 
 import org.apache.arrow.memory.AllocationManager;
 import org.apache.arrow.memory.ArrowBuf;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.BufferLedger;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /** Test cases for {@link UnsafeAllocationManager}. */
 public class TestUnsafeAllocationManager {
@@ -55,12 +55,12 @@ public class TestUnsafeAllocationManager {
     final long bufSize = 4096L;
     try (BufferAllocator allocator = createUnsafeAllocator();
         ArrowBuf buffer = allocator.buffer(bufSize)) {
-      assertTrue(buffer.getReferenceManager() instanceof BufferLedger);
+      assertInstanceOf(BufferLedger.class, buffer.getReferenceManager());
       BufferLedger bufferLedger = (BufferLedger) buffer.getReferenceManager();
 
       // make sure we are using unsafe allocation manager
       AllocationManager allocMgr = bufferLedger.getAllocationManager();
-      assertTrue(allocMgr instanceof UnsafeAllocationManager);
+      assertInstanceOf(UnsafeAllocationManager.class, allocMgr);
       UnsafeAllocationManager unsafeMgr = (UnsafeAllocationManager) allocMgr;
 
       assertEquals(bufSize, unsafeMgr.getSize());

Reply via email to