llama90 commented on code in PR #42093:
URL: https://github.com/apache/arrow/pull/42093#discussion_r1634300676


##########
java/tools/src/test/java/org/apache/arrow/tools/TestFileRoundtrip.java:
##########
@@ -18,40 +18,46 @@
 
 import static org.apache.arrow.tools.ArrowFileTestFixtures.validateOutput;
 import static org.apache.arrow.tools.ArrowFileTestFixtures.writeInput;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.File;
+import java.io.IOException;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 public class TestFileRoundtrip {
 
-  @Rule public TemporaryFolder testFolder = new TemporaryFolder();
+  @TempDir public File testFolder;
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void init() {
     allocator = new RootAllocator(Integer.MAX_VALUE);
   }
 
-  @After
+  @AfterEach
   public void tearDown() {
     allocator.close();
   }
 
   @Test
   public void test() throws Exception {
-    File testInFile = testFolder.newFile("testIn.arrow");
-    File testOutFile = testFolder.newFile("testOut.arrow");
+    File testInFile = new File(testFolder, "testIn.arrow");
+    File testOutFile = new File(testFolder, "testOut.arrow");
 
     writeInput(testInFile, allocator);
 
+    if (!testOutFile.exists()) {
+      if (!testOutFile.createNewFile()) {

Review Comment:
   Okay, I will try approach 2 tonight by creating a new issue.
   
   UPDATE:
   
   You are right. I also considered the asynchronous issue too, but it is not 
the case.



##########
java/tools/src/test/java/org/apache/arrow/tools/TestFileRoundtrip.java:
##########
@@ -18,40 +18,46 @@
 
 import static org.apache.arrow.tools.ArrowFileTestFixtures.validateOutput;
 import static org.apache.arrow.tools.ArrowFileTestFixtures.writeInput;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.io.File;
+import java.io.IOException;
 import org.apache.arrow.memory.BufferAllocator;
 import org.apache.arrow.memory.RootAllocator;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
 
 public class TestFileRoundtrip {
 
-  @Rule public TemporaryFolder testFolder = new TemporaryFolder();
+  @TempDir public File testFolder;
 
   private BufferAllocator allocator;
 
-  @Before
+  @BeforeEach
   public void init() {
     allocator = new RootAllocator(Integer.MAX_VALUE);
   }
 
-  @After
+  @AfterEach
   public void tearDown() {
     allocator.close();
   }
 
   @Test
   public void test() throws Exception {
-    File testInFile = testFolder.newFile("testIn.arrow");
-    File testOutFile = testFolder.newFile("testOut.arrow");
+    File testInFile = new File(testFolder, "testIn.arrow");
+    File testOutFile = new File(testFolder, "testOut.arrow");
 
     writeInput(testInFile, allocator);
 
+    if (!testOutFile.exists()) {
+      if (!testOutFile.createNewFile()) {

Review Comment:
   Okay, I will try approach 2 tonight by creating a new issue.
   
   UPDATE:
   
   > I merely mentioned thread sleep just to know if a pause is causing 
something to happen asynchronously. But it shouldn't be the case here.
   
   You are right. I also considered the asynchronous issue too, but it is not 
the case.



-- 
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