use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.
the class JSONReaderScannerTest_enum method test_x.
public void test_x() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"type\":\"XXXXXXXXXXXXXXXXXXXXXXXX\"}"));
VO vo = parser.parseObject(VO.class);
Assert.assertEquals(Type.XXXXXXXXXXXXXXXXXXXXXXXX, vo.getType());
parser.close();
}
use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.
the class JSONReaderScannerTest_enum method test_a.
public void test_a() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"type\":\"A\"}"));
VO vo = parser.parseObject(VO.class);
Assert.assertEquals(Type.A, vo.getType());
parser.close();
}
use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.
the class JSONReaderScannerTest_enum method test_c.
public void test_c() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"type\":\"C\"}"));
VO vo = parser.parseObject(VO.class);
Assert.assertEquals(Type.C, vo.getType());
parser.close();
}
use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.
the class JSONReaderScannerTest_negative method test_long.
public void test_long() throws Exception {
char[] chars = "{\"value\":-3L}".toCharArray();
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner(chars, chars.length));
JSONObject json = parser.parseObject();
Assert.assertTrue(-3L == ((Long) json.get("value")).longValue());
parser.close();
}
use of com.alibaba.fastjson.parser.JSONReaderScanner in project fastjson by alibaba.
the class JSONReaderScannerTest_negative method test_decimal.
public void test_decimal() throws Exception {
char[] chars = "{\"value\":-3.5}".toCharArray();
DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner(chars, chars.length));
JSONObject json = parser.parseObject();
Assert.assertEquals(new BigDecimal("-3.5"), json.get("value"));
parser.close();
}
Aggregations