public static void registerSerializers(Fury fury) {
    fury.registerSerializer(ArrowTable.class, new ArrowTableSerializer(fury));
    fury.registerSerializer(VectorSchemaRoot.class, new VectorSchemaRootSerializer(fury));
  }
@Test
  public void testWriteVectorSchemaRoot() throws IOException {
    Collection<BufferObject> bufferObjects = new ArrayList<>();
    Fury fury = Fury.builder().requireClassRegistration(false).build();
    ArrowSerializers.registerSerializers(fury);
    int size = 2000;
    VectorSchemaRoot root = ArrowUtilsTest.createVectorSchemaRoot(size);
    Assert.assertEquals(
        fury.getClassResolver().getSerializer(VectorSchemaRoot.class).getClass(),
        ArrowSerializers.VectorSchemaRootSerializer.class);
    byte[] serializedBytes = fury.serialize(root, e -> !bufferObjects.add(e));
    Assert.assertFalse(bufferObjects.isEmpty());
    List<MemoryBuffer> buffers =
        bufferObjects.stream().map(BufferObject::toBuffer).collect(Collectors.toList());
    MemoryBuffer buffer = buffers.get(0);

    MemoryBuffer buffer2 = MemoryUtils.buffer(32);
    try (ArrowStreamWriter writer =
        new ArrowStreamWriter(root, null, new MemoryBufferWritableChannel(buffer2))) {
      // this will make root empty.
      writer.writeBatch();
    }
    Assert.assertEquals(buffer.size(), buffer2.writerIndex());
    Assert.assertTrue(buffer.equalTo(buffer2, 0, 0, buffer.size()));

    VectorSchemaRoot newRoot = (VectorSchemaRoot) fury.deserialize(serializedBytes, buffers);
    assertRecordBatchEqual(newRoot, root);

    // test in band serialization.
    fury = Fury.builder().requireClassRegistration(false).build();
    ArrowSerializers.registerSerializers(fury);
    newRoot = (VectorSchemaRoot) fury.deserialize(fury.serialize(root));
    assertRecordBatchEqual(newRoot, root);
  }