use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderIntFieldTest method test_int_error_1_x1.
public void test_int_error_1_x1() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":-2147483649}"));
reader.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderIntFieldTest method test_int_error_map.
public void test_int_error_map() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":3001,\"value2\":-4001}["));
reader.readObject(new TypeReference<Map<String, Model>>() {
});
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderLongFieldTest method test_long_error_end.
public void test_long_error_end() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":1001,\"value2\":-2001["));
reader.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderLongFieldTest method test_long_normal_2.
public void test_long_normal_2() throws Exception {
JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":3001,\"value2\":-4001}}"));
Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
});
Model model = map.get("model");
Assert.assertEquals(3001L, model.value);
Assert.assertEquals(-4001L, model.value2);
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderLongFieldTest method test_long_error_1.
public void test_long_error_1() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":9223372036854775808}"));
reader.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Aggregations