Package com.alibaba.fastjson.parser

Examples of com.alibaba.fastjson.parser.DefaultExtJSONParser


    public void test_error_0() throws Exception {
        Exception error = null;
        try {
            String text = "[{\"old\":false,\"name\":\"校长\",\"age\":3,\"salary\":123456789.0123]";
            DefaultExtJSONParser parser = new DefaultExtJSONParser(text);
            parser.parseArray(User.class);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
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

    }

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

    }

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

    }

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

import com.alibaba.fastjson.parser.Feature;

public class DefaultExtJSONParserTest_6 extends TestCase {

    public void test_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{value:{,,,,\"value\":3,\"id\":1}}");
        parser.config(Feature.AllowArbitraryCommas, true);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue().getValue());
    }
View Full Code Here

        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue().getValue());
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{'value':{\"value\":3,\"id\":1}}");
        parser.config(Feature.AllowArbitraryCommas, false);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue().getValue());
    }
View Full Code Here

  protected void setUp() throws Exception {
  }

  public void test_0() throws Exception {
    DefaultExtJSONParser parser = new DefaultExtJSONParser("123");
    Assert.assertEquals(new Integer(123), (Integer) parser.parse());

    parser.config(Feature.IgnoreNotMatch, false);
  }
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.parser.DefaultExtJSONParser

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.