Package com.alibaba.fastjson.parser

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


        Assert.assertEquals(3L, a.getV5().longValue());
    }

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


    }

    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 {
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 {
View Full Code Here

        Assert.assertEquals(3, a.getA());
    }

    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 {
View Full Code Here

        Assert.assertEquals(3, a.getA());
    }

    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 {
View Full Code Here

        Assert.assertEquals(3, a.get("a"));
    }

    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 {
View Full Code Here

        Assert.assertEquals(3, a.get("a"));
    }

    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 {
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.