Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser.config()



    public void test_error_0() throws Exception {
        int featureValues = 0;
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{", ParserConfig.getGlobalInstance(), featureValues);
        parser.config(Feature.AllowUnQuotedFieldNames, true);

        Entity object = new Entity();
        DefaultObjectDeserializer objectDeser = new DefaultObjectDeserializer();
        Exception error = null;
        try {
View Full Code Here


    }
   
    public void test_error_1() throws Exception {
        int featureValues = 0;
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{\"value\":null", ParserConfig.getGlobalInstance(), featureValues);
        parser.config(Feature.AllowUnQuotedFieldNames, true);

        Entity object = new Entity();
        DefaultObjectDeserializer objectDeser = new DefaultObjectDeserializer();
        Exception error = null;
        try {
View Full Code Here

public class DefaultExtJSONParser_parseArray_2 extends TestCase {

    public void test_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[['1']]");
        parser.config(Feature.AllowISO8601DateFormat, false);
        List<List<Integer>> list = (List<List<Integer>>) parser.parseArrayWithType(new TypeReference<List<List<Integer>>>() {
        }.getType());
        Assert.assertEquals(new Integer(1), list.get(0).get(0));
    }
View Full Code Here

        Assert.assertEquals(new Integer(1), list.get(0).get(0));
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("['1','2']");
        parser.config(Feature.AllowISO8601DateFormat, false);
        List<Object> list = new ArrayList<Object>();
        parser.parseArray(Integer.class, list);
        Assert.assertEquals(new Integer(1), list.get(0));
        Assert.assertEquals(new Integer(2), list.get(1));
    }
View Full Code Here

        Assert.assertEquals(new Integer(2), list.get(1));
    }

    public void test_error_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("['1','2'}");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            List<Object> list = new ArrayList<Object>();
            parser.parseArray(Integer.class, list);
View Full Code Here

        Assert.assertNotNull(error);
    }

    public void test_error_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[['1']]");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArrayWithType(new TypeReference<Map<?, ?>>() {
            }.getType());
View Full Code Here

        Assert.assertNotNull(error);
    }

    public void test_error_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[new X()]");
        parser.config(Feature.AllowISO8601DateFormat, false);

        List list = new ArrayList();
        Exception error = null;
        try {
            parser.parseArray(list);
View Full Code Here

        Assert.assertNotNull(error);
    }

    public void test_error_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[] a");
        parser.config(Feature.AllowISO8601DateFormat, false);

        List list = new ArrayList();
        Exception error = null;
        try {
            parser.parseArray(list);
View Full Code Here

        Assert.assertNotNull(error);
    }

    public void test_error_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("['1','2'}");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {
            parser.parseArray(new Type[] {});
        } catch (Exception ex) {
View Full Code Here

        Assert.assertNotNull(error);
    }

    public void test_error_5() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("[]");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Assert.assertEquals(1, parser.parseArray(new Type[] { Integer[].class }).length);
    }
   
    public void test_error_6() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.