@Override
  public void write(MemoryBuffer buffer, T value) {
    for (FieldResolver.FieldInfo fieldInfo : fieldResolver.getEmbedTypes4Fields()) {
      buffer.writeInt32((int) fieldInfo.getEncodedFieldInfo());
      readAndWriteFieldValue(buffer, fieldInfo, value);
    }
    for (FieldResolver.FieldInfo fieldInfo : fieldResolver.getEmbedTypes9Fields()) {
      buffer.writeInt64(fieldInfo.getEncodedFieldInfo());
      readAndWriteFieldValue(buffer, fieldInfo, value);
    }
    for (FieldResolver.FieldInfo fieldInfo : fieldResolver.getEmbedTypesHashFields()) {
      buffer.writeInt64(fieldInfo.getEncodedFieldInfo());
      readAndWriteFieldValue(buffer, fieldInfo, value);
    }
    for (FieldResolver.FieldInfo fieldInfo : fieldResolver.getSeparateTypesHashFields()) {
      buffer.writeInt64(fieldInfo.getEncodedFieldInfo());
      readAndWriteFieldValue(buffer, fieldInfo, value);
    }
    buffer.writeInt64(fieldResolver.getEndTag());
  }
@Test(dataProvider = "referenceTrackingConfig")
  public void testWrite(boolean referenceTracking) {
    Fury fury =
        Fury.builder()
            .withLanguage(Language.JAVA)
            .withRefTracking(referenceTracking)
            .requireClassRegistration(false)
            .build();
    fury.registerSerializer(Foo.class, new CompatibleSerializer<>(fury, Foo.class));
    fury.registerSerializer(BeanA.class, new CompatibleSerializer<>(fury, BeanA.class));
    fury.registerSerializer(BeanB.class, new CompatibleSerializer<>(fury, BeanB.class));
    serDeCheck(fury, Foo.create());
    serDeCheck(fury, BeanB.createBeanB(2));
    serDeCheck(fury, BeanA.createBeanA(2));
  }