Beispiel #1
0
  public static void main(String argv[]) {

    A va = new A();
    System.out.println(va.a);
    va.setA(9);
    va.getA();
    OverridenVariable vb = new OverridenVariable();
    vb.getA();
    vb.setA(8);
    vb.getA();
    vb.setSuperA(7);
    vb.getA();
  }
  public void test_2() throws Exception {
    A res = new A();
    res.setA(1);
    res.setB(2);
    res.setC(3);

    String[] tests = {
      "{ 'a':1, 'b':2, 'c':3 }",
      "{ 'a':1,,'b':2, 'c':3 }",
      "{,'a':1, 'b':2, 'c':3 }",
      "{'a':1, 'b':2, 'c':3,,}",
      "{,,'a':1,,,,'b':2,,'c':3,,,,,}",
    };

    for (String t : tests) {
      DefaultJSONParser ext = new DefaultJSONParser(t);
      ext.config(Feature.AllowArbitraryCommas, true);

      A extRes = ext.parseObject(A.class);
      Assert.assertEquals(res, extRes);
    }
  }