content: package com.alibaba.fastjson2.primitves;
  
  import com.alibaba.fastjson2.JSONWriter;
  import com.alibaba.fastjson2.writer.ObjectWriter;
  import com.alibaba.fastjson2.writer.ObjectWriterCreator;
  import com.alibaba.fastjson2_vo.CharField1;
  import org.junit.jupiter.api.Test;
  
  import static org.junit.jupiter.api.Assertions.assertEquals;
  
  public class CharFieldTest {
      @Test
      public void test_arrayMapping() {
          ObjectWriterCreator[] creators = new ObjectWriterCreator[]{
                  ObjectWriterCreator.INSTANCE,
  //                ObjectWriterCreatorLambda.INSTANCE,
  //                ObjectWriterCreatorASM.INSTANCE
          };
  
          for (ObjectWriterCreator creator : creators) {
              ObjectWriter<CharField1> objectWriter = creator.createObjectWriter(CharField1.class);
  
              {
                  CharField1 vo = new CharField1();
                  vo.v0000 = 'A';
                  JSONWriter jsonWriter = JSONWriter.of();
                  objectWriter.write(jsonWriter, vo);
                  assertEquals("{\"v0000\":\"A\"}", jsonWriter.toString());
              }
              {
                  CharField1 vo = new CharField1();
                  JSONWriter jsonWriter = JSONWriter.of();
                  objectWriter.write(jsonWriter, vo);
                  assertEquals("{}", jsonWriter.toString());
              }
              {
                  CharField1 vo = new CharField1();
                  JSONWriter jsonWriter = JSONWriter.of();
                  jsonWriter.config(JSONWriter.Feature.WriteNulls);
                  objectWriter.write(jsonWriter, vo);
                  assertEquals("{\"v0000\":null}", jsonWriter.toString());
              }
              {
                  CharField1 vo = new CharField1();
                  vo.v0000 = 'A';
                  JSONWriter jsonWriter = JSONWriter.of();
                  jsonWriter.config(JSONWriter.Feature.BeanToArray);
                  objectWriter.write(jsonWriter, vo);
                  assertEquals("[\"A\"]", jsonWriter.toString());
              }
              {
                  CharField1 vo = new CharField1();
                  JSONWriter jsonWriter = JSONWriter.of();
                  jsonWriter.config(JSONWriter.Feature.BeanToArray);
                  objectWriter.write(jsonWriter, vo);
                  assertEquals("[null]", jsonWriter.toString());
              }
          }
      }
  }
  