use of com.alibaba.json.bvt.serializer.BooleanFieldSerializerTest.Entity in project fastjson by alibaba.
the class BooleanFieldSerializerTest_primitive method test_codec_no_asm.
public void test_codec_no_asm() throws Exception {
Entity v = new Entity();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(v, mapping, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"value\":false}", text);
Entity v1 = JSON.parseObject(text, Entity.class);
Assert.assertEquals(v.getValue(), v1.getValue());
}
use of com.alibaba.json.bvt.serializer.BooleanFieldSerializerTest.Entity in project fastjson by alibaba.
the class BooleanFieldSerializerTest_primitive method test_codec_2.
public void test_codec_2() throws Exception {
Entity v1 = parseObjectNoAsm("{value:null}", Entity.class, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(false, v1.getValue());
}
use of com.alibaba.json.bvt.serializer.BooleanFieldSerializerTest.Entity in project fastjson by alibaba.
the class BooleanFieldSerializerTest_primitive method test_codec_1.
public void test_codec_1() throws Exception {
Entity v1 = parseObjectNoAsm("{value:'true'}", Entity.class, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(true, v1.getValue());
}
use of com.alibaba.json.bvt.serializer.BooleanFieldSerializerTest.Entity in project fastjson by alibaba.
the class BooleanFieldSerializerTest_primitive method test_codec_0.
public void test_codec_0() throws Exception {
Entity v1 = parseObjectNoAsm("{value:0}", Entity.class, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(false, v1.getValue());
}
use of com.alibaba.json.bvt.serializer.BooleanFieldSerializerTest.Entity in project fastjson by alibaba.
the class BooleanFieldSerializerTest_primitive method test_codec_3.
public void test_codec_3() throws Exception {
Entity v1 = parseObjectNoAsm("{value:\"\"}", Entity.class, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(false, v1.getValue());
}
Aggregations