use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_10_d.
public void test_10_d() throws Exception {
SerializeWriter out = new SerializeWriter();
out.writeFieldName("123\na\nb\nc\nd\"'e", true);
Assert.assertEquals("\"123\\na\\nb\\nc\\nd\\\"'e\":", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_14.
public void test_14() throws Exception {
SerializeWriter out = new SerializeWriter(4);
out.config(SerializerFeature.UseSingleQuotes, false);
out.writeString("1\"");
Assert.assertEquals("\"1\\\"\"", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_3.
public void test_3() throws Exception {
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.config(SerializerFeature.UseSingleQuotes, true);
serializer.write(new TestEntity("张三"));
Assert.assertEquals("{'value':'张三'}", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_6.
public void test_6() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeString(null);
Assert.assertEquals("null", out.toString());
}
use of com.alibaba.fastjson.serializer.SerializeWriter in project fastjson by alibaba.
the class StringSerializerTest method test_10.
public void test_10() throws Exception {
SerializeWriter out = new SerializeWriter();
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeFieldName("123\na\nb\nc\nd\"'e");
Assert.assertEquals("'123\\na\\nb\\nc\\nd\"\\'e':", out.toString());
}
Aggregations