use of com.alibaba.fastjson.serializer.SerializeConfig in project fastjson by alibaba.
the class ByteFieldTest method test_codec_null_1.
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullNumberAsZero);
Assert.assertEquals("{\"value\":0}", text);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(Byte.valueOf((byte) 0), v1.getValue());
}
use of com.alibaba.fastjson.serializer.SerializeConfig in project fastjson by alibaba.
the class DoubleArrayFieldTest_primitive method test_codec_null.
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":null}", text);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
use of com.alibaba.fastjson.serializer.SerializeConfig in project fastjson by alibaba.
the class DoubleArrayFieldTest_primitive method test_codec_null_1.
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty);
Assert.assertEquals("{\"value\":[]}", text);
}
use of com.alibaba.fastjson.serializer.SerializeConfig in project fastjson by alibaba.
the class EmptyObjectTest method test_codec_null_1.
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullNumberAsZero);
Assert.assertEquals("{}", text);
}
use of com.alibaba.fastjson.serializer.SerializeConfig in project fastjson by alibaba.
the class LinkedListFieldTest method test_codec_null.
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":null}", text);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
Aggregations