Package com.alibaba.fastjson.serializer

Examples of com.alibaba.fastjson.serializer.CollectionSerializer


public class CollectionSerializerTest extends TestCase {

    public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        listSerializer.write(new JSONSerializer(out), Collections.EMPTY_LIST, null, null);

        Assert.assertEquals("[]", out.toString());
    }
View Full Code Here


    }

    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        listSerializer.write(new JSONSerializer(out), Collections.singletonList(1), null, null);

        Assert.assertEquals("[1]", out.toString());
    }
View Full Code Here

    }

    public void test_2_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1);
        list.add(2);
        listSerializer.write(new JSONSerializer(out), list, null, null);

        Assert.assertEquals("[1,2]", out.toString());
    }
View Full Code Here

    }

    public void test_3_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1);
        list.add(2);
        list.add(3);
        listSerializer.write(new JSONSerializer(out), list, null, null);

        Assert.assertEquals("[1,2,3]", out.toString());
    }
View Full Code Here

    }

    public void test_4_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        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);

        Assert.assertEquals("[1,2,3,{}]", out.toString());
    }
View Full Code Here

    }

    public void test_5_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        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);

        Assert.assertEquals("[1,21474836480,null,{},21474836480]", out.toString());
    }
View Full Code Here

public class CollectionSerializerTest extends TestCase {

    public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        listSerializer.write(new JSONSerializer(out), Collections.EMPTY_LIST, null, null, 0);

        Assert.assertEquals("[]", out.toString());
    }
View Full Code Here

    }

    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        listSerializer.write(new JSONSerializer(out), Collections.singletonList(1), null, null, 0);

        Assert.assertEquals("[1]", out.toString());
    }
View Full Code Here

    }

    public void test_2_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1);
        list.add(2);
        listSerializer.write(new JSONSerializer(out), list, null, null, 0);

        Assert.assertEquals("[1,2]", out.toString());
    }
View Full Code Here

    }

    public void test_3_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionSerializer listSerializer = new CollectionSerializer();
        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());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.serializer.CollectionSerializer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.