use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultJSONParserTest method test_error3.
public void test_error3() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("33");
parser.parseObject(new HashMap());
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultJSONParserTest method test_error4.
public void test_error4() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("]");
parser.parse();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DefaultJSONParserTest method test_error2.
public void test_error2() {
Exception error = null;
try {
DefaultJSONParser parser = new DefaultJSONParser("ttr");
parser.parse();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DateParserTest method test_date_new_1.
public void test_date_new_1() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("new Date(1294552193254)");
java.util.Date date = (java.util.Date) parser.parse();
Assert.assertEquals(new java.util.Date(1294552193254L), date);
parser.close();
}
use of com.alibaba.fastjson.parser.DefaultJSONParser in project fastjson by alibaba.
the class DateParserTest method test_date_new.
public void test_date_new() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("new Date(1294552193254)");
java.util.Date date = parser.parseObject(java.util.Date.class);
Assert.assertEquals(new java.util.Date(1294552193254L), date);
parser.close();
}
Aggregations