use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderBooleanFieldTest method test_bool_error_f0.
public void test_bool_error_f0() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":f}"));
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 ReaderBooleanFieldTest method test_bool_error_f3.
public void test_bool_error_f3() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":fals}"));
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 ReaderBooleanFieldTest method test_bool_error_map.
public void test_bool_error_map() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":false,\"value2\":true}["));
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 ReaderBooleanFieldTest method test_bool_normal_2.
public void test_bool_normal_2() throws Exception {
JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":false,\"value2\":true}}"));
Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
});
Model model = map.get("model");
Assert.assertFalse(model.value);
Assert.assertTrue(model.value2);
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class ReaderBooleanFieldTest method test_bool_error_0.
public void test_bool_error_0() throws Exception {
Exception error = null;
try {
JSONReader reader = new JSONReader(new StringReader("{\"value\":t}"));
reader.readObject(Model.class);
} catch (JSONException ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Aggregations