use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class EnumFieldTest2_private method test_error_1.
public void test_error_1() throws Exception {
Exception error = null;
try {
JSONReader read = new JSONReader(new StringReader("[null:null]"));
read.config(Feature.SupportArrayToBean, true);
Model model = read.readObject(Model.class);
read.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class EnumFieldTest2_private method test_error_nul.
public void test_error_nul() throws Exception {
Exception error = null;
try {
JSONReader read = new JSONReader(new StringReader("[nul"));
read.config(Feature.SupportArrayToBean, true);
Model model = read.readObject(Model.class);
read.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class EnumFieldTest2_private method test_2.
public void test_2() throws Exception {
JSONReader read = new JSONReader(new StringReader("[null,null]"));
read.config(Feature.SupportArrayToBean, true);
Model model = read.readObject(Model.class);
Assert.assertEquals(null, model.value);
Assert.assertEquals(null, model.value1);
read.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class EnumFieldTest2_private method test_0.
public void test_0() throws Exception {
JSONReader read = new JSONReader(new StringReader("[1,2]"));
read.config(Feature.SupportArrayToBean, true);
Model model = read.readObject(Model.class);
Assert.assertEquals(Type.B, model.value);
Assert.assertEquals(Type.C, model.value1);
read.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class EnumFieldTest2_private method test_error_nu.
public void test_error_nu() throws Exception {
Exception error = null;
try {
JSONReader read = new JSONReader(new StringReader("[nu"));
read.config(Feature.SupportArrayToBean, true);
Model model = read.readObject(Model.class);
read.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Aggregations