use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_int method test_error_0.
public void test_error_0() {
Exception error = null;
try {
JSONScanner lexer = new JSONScanner("--");
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_int method test_error_1.
public void test_error_1() {
Exception error = null;
try {
String text = Integer.MAX_VALUE + "1234";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_isEOF method test_2.
public void test_2() throws Exception {
JSONScanner lexer = new JSONScanner("1 ");
lexer.nextToken();
lexer.nextToken();
Assert.assertTrue(lexer.token() == JSONToken.EOF);
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_isEOF method test_1.
public void test_1() throws Exception {
JSONScanner lexer = new JSONScanner(" ");
lexer.nextToken();
Assert.assertTrue(lexer.token() == JSONToken.EOF);
}
use of com.alibaba.fastjson.parser.JSONScanner in project fastjson by alibaba.
the class JSONScannerTest_long method ftest_parse_long_1.
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
}
Aggregations