Package com.alibaba.fastjson.parser

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


    public void test_5() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{v5:\"3\"}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3L, a.getV5().longValue());
    }

    public void test_6() throws Exception {
        int features = JSON.DEFAULT_PARSER_FEATURE;
View Full Code Here


public class DefaultExtJSONParserTest_2 extends TestCase {

    public void test_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{'a':3}");
        parser.config(Feature.AllowSingleQuotes, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
View Full Code Here

    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        A a = parser.parseObject(A.class);
        Assert.assertEquals(3, a.getA());
    }

    public void test_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
View Full Code Here

    }

    public void test_2() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        Map a = parser.parseObject(Map.class);
        Assert.assertEquals(3, a.get("a"));
    }

    public void test_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
View Full Code Here

    }

    public void test_3() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        HashMap a = parser.parseObject(HashMap.class);
        Assert.assertEquals(3, a.get("a"));
    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
View Full Code Here

    }

    public void test_4() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{a:3}");
        parser.config(Feature.AllowUnQuotedFieldNames, true);
        LinkedHashMap a = parser.parseObject(LinkedHashMap.class);
        Assert.assertEquals(3, a.get("a"));
    }

    public void test_error_0() throws Exception {
        Exception error = null;
View Full Code Here

        ParserConfig config = new ParserConfig();
        config.setAsmEnable(false);

        DefaultExtJSONParser parser = new DefaultExtJSONParser(input, config, featureValues);
        T value = (T) parser.parseObject(clazz);

        if (clazz != JSONArray.class) {
            parser.close();
        }
View Full Code Here

    public void test_error_1() throws Exception {
        JSONException error = null;
        try {
            DefaultExtJSONParser parser = new DefaultExtJSONParser("{'a'3}");
            parser.config(Feature.AllowSingleQuotes, true);
            parser.parseObject(A.class);
        } catch (JSONException e) {
            error = e;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

    public void test_error_2() throws Exception {
        JSONException error = null;
        try {
            DefaultExtJSONParser parser = new DefaultExtJSONParser("{a 3}");
            parser.config(Feature.AllowUnQuotedFieldNames, true);
            parser.parseObject(A.class);
        } catch (JSONException e) {
            error = e;
        }
        Assert.assertNotNull(error);
    }
View Full Code Here

    public void test_error_3() throws Exception {
        JSONException error = null;
        try {
            DefaultExtJSONParser parser = new DefaultExtJSONParser("{");
            parser.config(Feature.AllowUnQuotedFieldNames, true);
            parser.parseObject(A.class);
        } catch (JSONException e) {
            error = e;
        }
        Assert.assertNotNull(error);
    }
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.