use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParserTest_2 method test_error_0.
public void test_error_0() throws Exception {
Exception error = null;
try {
String text = "[{\"old\":false,\"name\":\"校长\",\"age\":3,\"salary\":123456789.0123]";
DefaultJSONParser parser = new DefaultJSONParser(text);
parser.parseArray(User.class);
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParserTest_2 method test_error_5.
public void test_error_5() throws Exception {
JSONException error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("{a:3}");
parser.config(Feature.AllowUnQuotedFieldNames, false);
parser.parseObject(A.class);
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParserTest_2 method test_error_6.
public void test_error_6() throws Exception {
JSONException error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("{'a':3}");
parser.config(Feature.AllowSingleQuotes, false);
parser.parseObject(A.class);
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParserTest_2 method test_error_2.
public void test_error_2() throws Exception {
JSONException error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("{a 3}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.parseObject(A.class);
} catch (JSONException e) {
error = e;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParserTest_2 method test_2.
public void test_2() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{a:3}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Map a = parser.parseObject(Map.class);
Assert.assertEquals(3, a.get("a"));
}
Aggregations