package com.alibaba.json.bvt;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
public class StringFieldTest2 extends TestCase {
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":\"\"}", text);
}
public static class V0 {
@JSONField(serialzeFeatures=SerializerFeature.WriteNullStringAsEmpty)
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}