edtbl76 commented on code in PR #42161:
URL: https://github.com/apache/arrow/pull/42161#discussion_r1641916143


##########
java/memory/memory-core/src/test/java/org/apache/arrow/memory/TestForeignAllocation.java:
##########
@@ -82,26 +84,27 @@ public void wrapForeignAllocationWithAllocationListener() {
     assertEquals(16, listener.getTotalMem());
   }
 
-  @Test(expected = OutOfMemoryException.class)
-  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();
-      }
+    @Test
+    public void wrapForeignAllocationFailedWithAllocationListener() {
+        assertThrows(OutOfMemoryException.class, () -> {

Review Comment:
   Awesome, I can do that. I ran checkstyle. I didn't see spotless. I'll make a 
note of it for future as well!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to