parthchandra commented on code in PR #1422:
URL: https://github.com/apache/arrow-java/pull/1422#discussion_r4518795321


##########
c/src/test/java/org/apache/arrow/c/RoundtripTest.java:
##########
@@ -1060,6 +1062,74 @@ public void testSchemaStructReuse() {
     }
   }
 
+  @ParameterizedTest
+  @ValueSource(longs = {-1L, Long.MIN_VALUE, Integer.MAX_VALUE + 1L, (1L << 
32) - 100})
+  public void testImportRejectsInvalidLength(long length) {
+    try (IntVector vector = new IntVector("ints", allocator)) {
+      setVector(vector, 1, 2, 3);
+      assertImportRejected(vector, "ints", array -> setLength(array, length));
+    }
+  }
+
+  @ParameterizedTest
+  @ValueSource(longs = {-1L, Long.MIN_VALUE, Integer.MAX_VALUE + 1L, (1L << 
32) - 100})
+  public void testImportRejectsInvalidStructLength(long length) {
+    try (StructVector vector = createStructWithTwoChildren()) {
+      assertImportRejected(vector, "struct", array -> setLength(array, 
length));
+    }
+  }
+
+  @ParameterizedTest
+  @ValueSource(longs = {-1L, Long.MIN_VALUE, Integer.MAX_VALUE + 1L, (1L << 
32) - 100})
+  public void testImportRejectsInvalidChildLength(long length) {
+    try (StructVector vector = createStructWithTwoChildren()) {
+      assertImportRejected(

Review Comment:
   This test checks that the error message contains "second". But the parent 
struct's field text is Struct<first: Int(32, true), second: Int(32, true)>, 
which also contains "second". So the test would still pass if the error only 
named the parent struct. Could you check for something only the child's error 
would contain, like "second: Int(32, true)" at the start of the field text? Or 
you could check the cause chain.



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