use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class LongFieldTest_2_stream method test_max.
public void test_max() throws Exception {
V0 v = new V0();
v.setValue(Long.MIN_VALUE);
String text = JSON.toJSONString(v);
JSONReader reader = new JSONReader(new StringReader(text));
V0 v1 = reader.readObject(V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class LongFieldTest_2_stream method test_min.
public void test_min() throws Exception {
V0 v = new V0();
v.setValue(Long.MIN_VALUE);
String text = JSON.toJSONString(v);
JSONReader reader = new JSONReader(new StringReader(text));
V0 v1 = reader.readObject(V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class LongFieldTest_2_stream method test_max_array.
public void test_max_array() throws Exception {
V0 v = new V0();
v.setValue(Long.MIN_VALUE);
String text = JSON.toJSONString(v, SerializerFeature.BeanToArray);
JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
V0 v1 = reader.readObject(V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class LongFieldTest_2_stream method test_min_array.
public void test_min_array() throws Exception {
V0 v = new V0();
v.setValue(Long.MIN_VALUE);
String text = JSON.toJSONString(v, SerializerFeature.BeanToArray);
JSONReader reader = new JSONReader(new StringReader(text), Feature.SupportArrayToBean);
V0 v1 = reader.readObject(V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class StringFieldTest_special method test_special.
public void test_special() throws Exception {
Model model = new Model();
model.name = "a\\bc";
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"name\":\"a\\\\bc\"}", text);
JSONReader reader = new JSONReader(new StringReader(text));
Model model2 = reader.readObject(Model.class);
Assert.assertEquals(model.name, model2.name);
reader.close();
}
Aggregations