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


##########
java/tools/src/test/java/org/apache/arrow/tools/TestFileRoundtrip.java:
##########
@@ -58,4 +61,36 @@ public void test() throws Exception {
 
     validateOutput(testOutFile, allocator);
   }
+
+  @Test
+  public void testDiffFolder() throws Exception {
+    File testInFile = testFolder.newFile("testIn.arrow");
+    File testOutFile = testAnotherFolder.newFile("testOut.arrow");
+
+    writeInput(testInFile, allocator);
+
+    String[] args = {"-i", testInFile.getAbsolutePath(), "-o", 
testOutFile.getAbsolutePath()};
+    int result = new FileRoundtrip(System.err).run(args);
+    assertEquals(0, result);
+
+    validateOutput(testOutFile, allocator);
+  }
+
+  @Test
+  public void testNotPreparedInput() throws Exception {
+    File testInFile = testFolder.newFile("testIn.arrow");
+    File testOutFile = testFolder.newFile("testOut.arrow");
+
+    String[] args = {"-i", testInFile.getAbsolutePath(), "-o", 
testOutFile.getAbsolutePath()};
+
+    // In JUnit 5, since the file itself is not created, the exception and 
message will be
+    // different.
+    Exception exception =
+        assertThrows(
+            InvalidArrowFileException.class,
+            () -> {
+              new FileRoundtrip(System.err).run(args);
+            });
+    assertEquals("file too small: 0", exception.getMessage());

Review Comment:
   No. 
   
   In JUnit 5, I want to check for `IllegalArgumentException` and `input file 
not found` errors. 
   
   The code I wrote still works with JUnit 4 logic, so the tests don't write 
the input (`writeInput(testInFile, allocator)`). Because the file exists, I can 
see these exceptions happening.



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