use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParser_parseArray method test_error_4.
public void test_error_4() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1,null }");
parser.config(Feature.AllowISO8601DateFormat, false);
Exception error = null;
try {
parser.parseArray(new Type[] { String.class });
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParser_parseArray method test_14.
public void test_14() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[]");
Object[] array = parser.parseArray(new Type[] {});
Assert.assertEquals(0, array.length);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParser_parseArray method test_11.
public void test_11() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1]");
Object[] array = parser.parseArray(new Type[] { String.class });
Assert.assertEquals("1", array[0]);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParser_parseArray method test_6.
public void test_6() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("[1.2]");
parser.config(Feature.UseBigDecimal, false);
ArrayList list = new ArrayList();
parser.parseArray(list);
Assert.assertEquals(Double.valueOf(1.2), list.get(0));
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultExtJSONParser_parseArray method test_13.
public void test_13() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("['1']");
Object[] array = parser.parseArray(new Type[] { Integer.class });
Assert.assertEquals(new Integer(1), array[0]);
}
Aggregations