Package com.alibaba.fastjson.parser

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


    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

    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());
    }

    public void test_1() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("{'value':{\"value\":3,\"id\":1}}");
View Full Code Here

    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());
    }

    public static class Entity {
View Full Code Here

    parser.parseArray(Class.class);
  }

  public void test_2() throws Exception {
    DefaultExtJSONParser parser = new DefaultExtJSONParser("{}");
    parser.parseObject(Object.class);
  }

  public void test_3() throws Exception {
    DefaultExtJSONParser parser = new DefaultExtJSONParser("{}");
    parser.parseObject(User.class);
View Full Code Here

    parser.parseObject(Object.class);
  }

  public void test_3() throws Exception {
    DefaultExtJSONParser parser = new DefaultExtJSONParser("{}");
    parser.parseObject(User.class);
  }

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

  public void test_error_0() throws Exception {
    JSONException error = null;
    try {
      DefaultExtJSONParser parser = new DefaultExtJSONParser("123");
      parser.parseObject(Class.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(
          "[\"age\":33}");
      parser.parseObject(new User());
    } catch (JSONException e) {
      error = e;
    }
    Assert.assertNotNull(error);
  }
View Full Code Here

public class DateParserTest_sql extends TestCase {

    public void f_test_date_0() throws Exception {
        DefaultExtJSONParser parser = new DefaultExtJSONParser("1294552193254");

        java.sql.Date date = parser.parseObject(java.sql.Date.class);

        Assert.assertEquals(new java.sql.Date(1294552193254L), date);
    }

    public void test_date_1() 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.