use of com.alibaba.fastjson.serializer.CollectionCodec in project fastjson by alibaba.
the class CollectionSerializerTest method test_0.
public void test_0() throws Exception {
SerializeWriter out = new SerializeWriter();
CollectionCodec listSerializer = new CollectionCodec();
listSerializer.write(new JSONSerializer(out), Collections.EMPTY_LIST, null, null, 0);
Assert.assertEquals("[]", out.toString());
}
use of com.alibaba.fastjson.serializer.CollectionCodec in project fastjson by alibaba.
the class CollectionSerializerTest method test_4_s.
public void test_4_s() throws Exception {
SerializeWriter out = new SerializeWriter();
CollectionCodec listSerializer = new CollectionCodec();
List<Object> list = new ArrayList<Object>();
list.add(1L);
list.add(2L);
list.add(3L);
list.add(Collections.emptyMap());
listSerializer.write(new JSONSerializer(out), list, null, null, 0);
Assert.assertEquals("[1,2,3,{}]", out.toString());
}
use of com.alibaba.fastjson.serializer.CollectionCodec in project fastjson by alibaba.
the class CollectionSerializerTest method test_1.
public void test_1() throws Exception {
SerializeWriter out = new SerializeWriter();
CollectionCodec listSerializer = new CollectionCodec();
listSerializer.write(new JSONSerializer(out), Collections.singletonList(1), null, null, 0);
Assert.assertEquals("[1]", out.toString());
}
use of com.alibaba.fastjson.serializer.CollectionCodec in project fastjson by alibaba.
the class CollectionSerializerTest method test_5_s.
public void test_5_s() throws Exception {
SerializeWriter out = new SerializeWriter();
CollectionCodec listSerializer = new CollectionCodec();
List<Object> list = new ArrayList<Object>();
list.add(1L);
list.add(21474836480L);
list.add(null);
list.add(Collections.emptyMap());
list.add(21474836480L);
listSerializer.write(new JSONSerializer(out), list, null, null, 0);
Assert.assertEquals("[1,21474836480,null,{},21474836480]", out.toString());
}
use of com.alibaba.fastjson.serializer.CollectionCodec in project fastjson by alibaba.
the class CollectionSerializerTest method test_3_s.
public void test_3_s() throws Exception {
SerializeWriter out = new SerializeWriter();
CollectionCodec listSerializer = new CollectionCodec();
List<Object> list = new ArrayList<Object>();
list.add(1);
list.add(2);
list.add(3);
listSerializer.write(new JSONSerializer(out), list, null, null, 0);
Assert.assertEquals("[1,2,3]", out.toString());
}
Aggregations