diff --git a/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java b/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java index 768394ef7ab60..a0ee5eecb152b 100644 --- a/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java +++ b/java/c/src/test/java/org/apache/arrow/c/RoundtripTest.java @@ -524,6 +524,42 @@ public void testVarCharVector() { } } + @Test + public void testEmptyVarCharVector() { + try (final VarCharVector vector = new VarCharVector("v", allocator)) { + vector.allocateNewSafe(); + vector.setValueCount(0); + assertTrue(roundtrip(vector, VarCharVector.class)); + } + } + + @Test + public void testEmptyLargeVarCharVector() { + try (final LargeVarCharVector vector = new LargeVarCharVector("v", allocator)) { + vector.allocateNewSafe(); + vector.setValueCount(0); + assertTrue(roundtrip(vector, LargeVarCharVector.class)); + } + } + + @Test + public void testEmptyVarBinaryVector() { + try (final VarBinaryVector vector = new VarBinaryVector("v", allocator)) { + vector.allocateNewSafe(); + vector.setValueCount(0); + assertTrue(roundtrip(vector, VarBinaryVector.class)); + } + } + + @Test + public void testEmptyLargeVarBinaryVector() { + try (final LargeVarBinaryVector vector = new LargeVarBinaryVector("v", allocator)) { + vector.allocateNewSafe(); + vector.setValueCount(0); + assertTrue(roundtrip(vector, LargeVarBinaryVector.class)); + } + } + @Test public void testLargeVarBinaryVector() { try (final LargeVarBinaryVector vector = new LargeVarBinaryVector("", allocator)) {