The following issues were found
src/test/java/com/alibaba/json/test/JSONParser2Test.java
21 issues
Line: 56
f_jackson();
// f_simple_json();
System.out.println();
}
System.out.println();
System.out.println(text);
}
Reported by PMD.
Line: 59
System.out.println();
}
System.out.println();
System.out.println(text);
}
public void f_ali_json() throws Exception {
// String input = "[{\"a\":3}]";
Reported by PMD.
Line: 60
}
System.out.println();
System.out.println(text);
}
public void f_ali_json() throws Exception {
// String input = "[{\"a\":3}]";
long startNano = System.nanoTime();
Reported by PMD.
Line: 71
parser.parse();
}
long nano = System.nanoTime() - startNano;
System.out.println("fast-json \t: " + NumberFormat.getInstance().format(nano));
}
private void f_jackson() throws Exception {
long startNano = System.nanoTime();
for (int i = 0; i < COUNT; ++i) {
Reported by PMD.
Line: 83
// JsonNode body = node.get(1);
}
long nano = System.nanoTime() - startNano;
System.out.println("jackson \t: " + NumberFormat.getInstance().format(nano));
}
}
Reported by PMD.
Line: 30
public class JSONParser2Test extends TestCase {
private String text;
private int COUNT = 1000 * 10;
protected void setUp() throws Exception {
// String resource = "json/Bug_0_Test.json";
String resource = "json/Bug_0_Test.json";
Reported by PMD.
Line: 31
public class JSONParser2Test extends TestCase {
private String text;
private int COUNT = 1000 * 10;
protected void setUp() throws Exception {
// String resource = "json/Bug_0_Test.json";
String resource = "json/Bug_0_Test.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
Reported by PMD.
Line: 31
public class JSONParser2Test extends TestCase {
private String text;
private int COUNT = 1000 * 10;
protected void setUp() throws Exception {
// String resource = "json/Bug_0_Test.json";
String resource = "json/Bug_0_Test.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
Reported by PMD.
Line: 33
private String text;
private int COUNT = 1000 * 10;
protected void setUp() throws Exception {
// String resource = "json/Bug_0_Test.json";
String resource = "json/Bug_0_Test.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
text = IOUtils.toString(is);
is.close();
Reported by PMD.
Line: 36
protected void setUp() throws Exception {
// String resource = "json/Bug_0_Test.json";
String resource = "json/Bug_0_Test.json";
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
text = IOUtils.toString(is);
is.close();
// text =
// "[{\"S\":321061,\"T\":\"GetAttributeResp\"},{\"ERROR\":null,\"TS\":0,\"VAL\":{\"SqlList\":[{\"BatchSizeMax\":0,\"BatchSizeTotal\":0,\"ConcurrentMax\":1,\"DataSource\":\"jdbc:wrap-jdbc:filters=default,encoding:name=ds-offer:jdbc:mysql://100.10.10.10:8066/xxx\",\"EffectedRowCount\":0,\"ErrorCount\":0,\"ExecuteCount\":5,\"FetchRowCount\":5,\"File\":null,\"ID\":2001,\"LastError\":null,\"LastTime\":1292742908178,\"MaxTimespan\":16,\"MaxTimespanOccurTime\":1292742668191,\"Name\":null,\"RunningCount\":0,\"SQL\":\"SELECT @@SQL_MODE\",\"TotalTime\":83}]}}]";
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_BrowserSecure_5_script_model.java
21 issues
Line: 13
public class SerializeWriterTest_BrowserSecure_5_script_model extends TestCase {
public void test_0() throws Exception {
Model object = new Model();
object.value = "<script>alert(1);</script>";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
Reported by PMD.
Line: 13
public class SerializeWriterTest_BrowserSecure_5_script_model extends TestCase {
public void test_0() throws Exception {
Model object = new Model();
object.value = "<script>alert(1);</script>";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
Reported by PMD.
Line: 18
object.value = "<script>alert(1);</script>";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
Model object1 = JSON.parseObject(text, Model.class);
assertEquals(object.value, object1.value);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 20
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
Model object1 = JSON.parseObject(text, Model.class);
assertEquals(object.value, object1.value);
}
public void test_1() throws Exception {
Model object = new Model();
object.value = "<";
Reported by PMD.
Line: 23
assertEquals(object.value, object1.value);
}
public void test_1() throws Exception {
Model object = new Model();
object.value = "<";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003C\"}", text);
Reported by PMD.
Line: 23
assertEquals(object.value, object1.value);
}
public void test_1() throws Exception {
Model object = new Model();
object.value = "<";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003C\"}", text);
Reported by PMD.
Line: 28
object.value = "<";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003C\"}", text);
Model object1 = JSON.parseObject(text, Model.class);
assertEquals(object.value, object1.value);
}
public void test_2() throws Exception {
Reported by PMD.
Line: 30
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003C\"}", text);
Model object1 = JSON.parseObject(text, Model.class);
assertEquals(object.value, object1.value);
}
public void test_2() throws Exception {
Model object = new Model();
object.value = "<script>";
Reported by PMD.
Line: 33
assertEquals(object.value, object1.value);
}
public void test_2() throws Exception {
Model object = new Model();
object.value = "<script>";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003E\"}", text);
Reported by PMD.
Line: 33
assertEquals(object.value, object1.value);
}
public void test_2() throws Exception {
Model object = new Model();
object.value = "<script>";
String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
// assertEquals("{\"value\":\"<script>alert(1);<\\/script>\"}", text);
assertEquals("{\"value\":\"\\u003Cscript\\u003E\"}", text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_fushou.java
21 issues
Line: 15
public class Bug_for_fushou extends TestCase{
public void test_case1() {
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
Reported by PMD.
Line: 15
public class Bug_for_fushou extends TestCase{
public void test_case1() {
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
Reported by PMD.
Line: 19
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
Reported by PMD.
Line: 19
String text = "{\"modules\":{}}";
L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
});
assertEquals(true, r1.getModules() instanceof L2);
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
Reported by PMD.
Line: 23
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
Reported by PMD.
Line: 23
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
Reported by PMD.
Line: 24
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
Reported by PMD.
Line: 24
L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(true, r2.getModules() instanceof JSONObject);
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
Reported by PMD.
Line: 27
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(JSONObject.class, r0.getModules().getClass());
Reported by PMD.
Line: 27
assertEquals(false, r2.getModules() instanceof L2);
}
public void test_case2() {
String text = "{\"modules\":{}}";
L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
});
assertEquals(JSONObject.class, r0.getModules().getClass());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_field_access_filter_in_string.java
21 issues
Line: 14
public class JSONPath_field_access_filter_in_string extends TestCase {
public void test_list_in() throws Exception {
JSONPath path = new JSONPath("[name in ('ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
Reported by PMD.
Line: 18
JSONPath path = new JSONPath("[name in ('ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, "yakolee"));
entities.add(new Entity(1004, null));
List<Object> result = (List<Object>) path.eval(entities);
Reported by PMD.
Line: 19
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, "yakolee"));
entities.add(new Entity(1004, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Reported by PMD.
Line: 20
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
entities.add(new Entity(1003, "yakolee"));
entities.add(new Entity(1004, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
Reported by PMD.
Line: 24
entities.add(new Entity(1004, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_not_in() throws Exception {
JSONPath path = new JSONPath("[name not in ('ljw2083')]");
Reported by PMD.
Line: 25
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(1, result.size());
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_not_in() throws Exception {
JSONPath path = new JSONPath("[name not in ('ljw2083')]");
Reported by PMD.
Line: 28
Assert.assertSame(entities.get(0), result.get(0));
}
public void test_list_not_in() throws Exception {
JSONPath path = new JSONPath("[name not in ('ljw2083')]");
List<Entity> entities = new ArrayList<Entity>();
entities.add(new Entity(1001, "ljw2083"));
entities.add(new Entity(1002, "wenshao"));
Reported by PMD.
Line: 38
entities.add(new Entity(1004, null));
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(3, result.size());
Assert.assertSame(entities.get(1), result.get(0));
Assert.assertSame(entities.get(2), result.get(1));
Assert.assertSame(entities.get(3), result.get(2));
}
Reported by PMD.
Line: 39
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(3, result.size());
Assert.assertSame(entities.get(1), result.get(0));
Assert.assertSame(entities.get(2), result.get(1));
Assert.assertSame(entities.get(3), result.get(2));
}
public void test_list_in_2() throws Exception {
Reported by PMD.
Line: 40
List<Object> result = (List<Object>) path.eval(entities);
Assert.assertEquals(3, result.size());
Assert.assertSame(entities.get(1), result.get(0));
Assert.assertSame(entities.get(2), result.get(1));
Assert.assertSame(entities.get(3), result.get(2));
}
public void test_list_in_2() throws Exception {
JSONPath path = new JSONPath("[name in ('ljw2083', 'yakolee')]");
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/list/ListStringFieldTest_dom_array_2.java
21 issues
Line: 21
public class ListStringFieldTest_dom_array_2 extends TestCase {
public void test_list() throws Exception {
String text = "[[\"a\",null,\"b\",\"ab\\\\c\"],[]]";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Reported by PMD.
Line: 25
String text = "[[\"a\",null,\"b\",\"ab\\\\c\"],[]]";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Reported by PMD.
Line: 26
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
Reported by PMD.
Line: 27
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
}
Reported by PMD.
Line: 28
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
}
Reported by PMD.
Line: 29
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
}
public void test_list2() throws Exception {
Reported by PMD.
Line: 31
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
}
public void test_list2() throws Exception {
String text = "{\"values\":[\"a\",null,\"b\",\"ab\\\\c\"],\"values2\":[]}";
Reported by PMD.
Line: 34
Assert.assertEquals(0, model.values2.size());
}
public void test_list2() throws Exception {
String text = "{\"values\":[\"a\",null,\"b\",\"ab\\\\c\"],\"values2\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Reported by PMD.
Line: 38
String text = "{\"values\":[\"a\",null,\"b\",\"ab\\\\c\"],\"values2\":[]}";
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Reported by PMD.
Line: 39
Model model = JSON.parseObject(text, Model.class);
Assert.assertEquals(4, model.values.size());
Assert.assertEquals("a", model.values.get(0));
Assert.assertEquals(null, model.values.get(1));
Assert.assertEquals("b", model.values.get(2));
Assert.assertEquals("ab\\c", model.values.get(3));
Assert.assertEquals(0, model.values2.size());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2600/Issue2689.java
21 issues
Line: 9
public class Issue2689 extends TestCase
{
public void test_0() throws Exception {
Exception error = null;
try {
JSON.parse("{\"val\":\"\\x~\"");
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 16
} catch (JSONException ex) {
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_1() throws Exception {
Exception error = null;
Reported by PMD.
Line: 17
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 17
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 17
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_1() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 20
error.getMessage().startsWith("invalid escape character"));
}
public void test_1() throws Exception {
Exception error = null;
try {
JSON.parse("{\"val\":'\\x~'");
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 27
} catch (JSONException ex) {
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_2() throws Exception {
Exception error = null;
Reported by PMD.
Line: 28
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_2() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 28
error = ex;
}
assertTrue(
error.getMessage().startsWith("invalid escape character"));
}
public void test_2() throws Exception {
Exception error = null;
try {
Reported by PMD.
Line: 31
error.getMessage().startsWith("invalid escape character"));
}
public void test_2() throws Exception {
Exception error = null;
try {
JSON.parse("{\"val\":'\\x1'");
} catch (JSONException ex) {
error = ex;
Reported by PMD.
src/test/java/com/alibaba/json/bvtVO/DataTransaction.java
21 issues
Line: 316
dt.getBody().getParam().setForm(m2);
System.out.println(dt.toJSON());
DataTransaction dt2 = DataTransaction.fromJSON(dt.toJSON());
System.out.println(dt2.toJSON());
}
}
Reported by PMD.
Line: 319
System.out.println(dt.toJSON());
DataTransaction dt2 = DataTransaction.fromJSON(dt.toJSON());
System.out.println(dt2.toJSON());
}
}
Reported by PMD.
Line: 1
package com.alibaba.json.bvtVO;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
Reported by PMD.
Line: 19
private static final long serialVersionUID = 1L;
private Head head = new Head();
private Body body = new Body();
public DataTransaction(){
Reported by PMD.
Line: 19
private static final long serialVersionUID = 1L;
private Head head = new Head();
private Body body = new Body();
public DataTransaction(){
Reported by PMD.
Line: 21
private Head head = new Head();
private Body body = new Body();
public DataTransaction(){
}
Reported by PMD.
Line: 21
private Head head = new Head();
private Body body = new Body();
public DataTransaction(){
}
Reported by PMD.
Line: 30
/**
* Head
**/
public static class Head {
private String appid;
private String transcode;
Reported by PMD.
Line: 61
/**
* 处理结果
*/
public static class Ret {
private String code;
private String msg;
public String getCode() {
Reported by PMD.
Line: 135
/**
* Body
*/
public static class Body {
private Param param = new Param();
private DataSet dataset;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_long.java
21 issues
Line: 16
public class JSONScannerTest_long extends TestCase {
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846476");
lexer.scanNumber();
Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
Assert.assertEquals(1293770846476L, lexer.longValue());
}
Reported by PMD.
Line: 19
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846476");
lexer.scanNumber();
Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
Assert.assertEquals(1293770846476L, lexer.longValue());
}
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
Reported by PMD.
Line: 24
}
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());
}
Reported by PMD.
Line: 27
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());
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
Reported by PMD.
Line: 32
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
}
Reported by PMD.
Line: 35
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
}
public void test_error_0() {
Exception error = null;
Reported by PMD.
Line: 15
*/
public class JSONScannerTest_long extends TestCase {
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846476");
lexer.scanNumber();
Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
Assert.assertEquals(1293770846476L, lexer.longValue());
Reported by PMD.
Line: 23
Assert.assertEquals(1293770846476L, lexer.longValue());
}
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());
Reported by PMD.
Line: 31
Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
Reported by PMD.
Line: 39
Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
}
public void test_error_0() {
Exception error = null;
try {
JSONScanner lexer = new JSONScanner("--");
lexer.scanNumber();
lexer.longValue();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/comparing_json_modules/Floating_point_Test.java
21 issues
Line: 11
* Created by wenshao on 24/03/2017.
*/
public class Floating_point_Test extends TestCase {
public void test_2_1() throws Exception {
assertEquals("0.0", JSON.toJSONString(0.0));
}
public void test_2_2() throws Exception {
assertEquals("-0.0", JSON.toJSONString(-0.0F));
Reported by PMD.
Line: 12
*/
public class Floating_point_Test extends TestCase {
public void test_2_1() throws Exception {
assertEquals("0.0", JSON.toJSONString(0.0));
}
public void test_2_2() throws Exception {
assertEquals("-0.0", JSON.toJSONString(-0.0F));
}
Reported by PMD.
Line: 15
assertEquals("0.0", JSON.toJSONString(0.0));
}
public void test_2_2() throws Exception {
assertEquals("-0.0", JSON.toJSONString(-0.0F));
}
public void test_2_3() throws Exception {
assertEquals("1.0", JSON.toJSONString(1.0));
Reported by PMD.
Line: 16
}
public void test_2_2() throws Exception {
assertEquals("-0.0", JSON.toJSONString(-0.0F));
}
public void test_2_3() throws Exception {
assertEquals("1.0", JSON.toJSONString(1.0));
}
Reported by PMD.
Line: 19
assertEquals("-0.0", JSON.toJSONString(-0.0F));
}
public void test_2_3() throws Exception {
assertEquals("1.0", JSON.toJSONString(1.0));
}
public void test_2_4() throws Exception {
assertEquals("0.1", JSON.toJSONString(0.1));
Reported by PMD.
Line: 20
}
public void test_2_3() throws Exception {
assertEquals("1.0", JSON.toJSONString(1.0));
}
public void test_2_4() throws Exception {
assertEquals("0.1", JSON.toJSONString(0.1));
}
Reported by PMD.
Line: 23
assertEquals("1.0", JSON.toJSONString(1.0));
}
public void test_2_4() throws Exception {
assertEquals("0.1", JSON.toJSONString(0.1));
}
public void test_2_5() throws Exception {
assertEquals("3.141592653589793", JSON.toJSONString(Math.PI));
Reported by PMD.
Line: 24
}
public void test_2_4() throws Exception {
assertEquals("0.1", JSON.toJSONString(0.1));
}
public void test_2_5() throws Exception {
assertEquals("3.141592653589793", JSON.toJSONString(Math.PI));
}
Reported by PMD.
Line: 27
assertEquals("0.1", JSON.toJSONString(0.1));
}
public void test_2_5() throws Exception {
assertEquals("3.141592653589793", JSON.toJSONString(Math.PI));
}
public void test_2_6() throws Exception {
double doubeValue = Math.pow(Math.PI, 100);
Reported by PMD.
Line: 28
}
public void test_2_5() throws Exception {
assertEquals("3.141592653589793", JSON.toJSONString(Math.PI));
}
public void test_2_6() throws Exception {
double doubeValue = Math.pow(Math.PI, 100);
assertEquals("5.187848314319592E49", JSON.toJSONString(doubeValue));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_int.java
21 issues
Line: 16
public class JSONScannerTest_int extends TestCase {
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846");
lexer.scanNumber();
Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
Assert.assertEquals(1293770846, lexer.intValue());
}
Reported by PMD.
Line: 19
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846");
lexer.scanNumber();
Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
Assert.assertEquals(1293770846, lexer.intValue());
}
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
Reported by PMD.
Line: 24
}
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
}
Reported by PMD.
Line: 27
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
Reported by PMD.
Line: 32
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
}
Reported by PMD.
Line: 35
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
}
public void test_error_0() {
Exception error = null;
Reported by PMD.
Line: 15
*/
public class JSONScannerTest_int extends TestCase {
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846");
lexer.scanNumber();
Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
Assert.assertEquals(1293770846, lexer.intValue());
Reported by PMD.
Line: 23
Assert.assertEquals(1293770846, lexer.intValue());
}
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
Reported by PMD.
Line: 31
Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
}
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
Reported by PMD.
Line: 39
Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
}
public void test_error_0() {
Exception error = null;
try {
JSONScanner lexer = new JSONScanner("--");
lexer.scanNumber();
lexer.intValue();
Reported by PMD.