The following issues were found
src/test/java/com/alibaba/json/bvt/path/JSONPath_map_size.java
2 issues
Line: 12
import junit.framework.TestCase;
public class JSONPath_map_size extends TestCase {
public void test_list_size() throws Exception {
Assert.assertEquals(0, JSONPath.eval(Collections.emptyMap(), "$.size"));
}
public void test_list_size1() throws Exception {
Assert.assertEquals(0, JSONPath.eval(Collections.emptyMap(), "$.size()"));
Reported by PMD.
Line: 16
Assert.assertEquals(0, JSONPath.eval(Collections.emptyMap(), "$.size"));
}
public void test_list_size1() throws Exception {
Assert.assertEquals(0, JSONPath.eval(Collections.emptyMap(), "$.size()"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/awt/PointDeserializerTest2.java
2 issues
Line: 14
public class PointDeserializerTest2 extends TestCase {
public void test_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"z\":44}", Point.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 15
public class PointDeserializerTest2 extends TestCase {
public void test_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"z\":44}", Point.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_remove_test.java
2 issues
Line: 16
public class JSONPath_remove_test extends TestCase {
public void test_remove() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
root.put("name", "wenshao");
root.put("salary", 1234567890);
Assert.assertTrue(JSONPath.remove(root, "/name"));
Assert.assertEquals(1, root.size());
Reported by PMD.
Line: 27
Assert.assertFalse(JSONPath.remove(root, "/name"));
}
public void test_remove_list() throws Exception {
List<Object> root = new ArrayList<Object>();
root.add("wenshao");
root.add(1234567890);
Assert.assertTrue(JSONPath.remove(root, "/0"));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_set_test3.java
2 issues
Line: 14
public class JSONPath_set_test3 extends TestCase {
public void test_jsonpath_leve_1() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
JSONPath.set(root, "/id", 1001);
Assert.assertEquals(1001, JSONPath.eval(root, "/id"));
Reported by PMD.
Line: 22
Assert.assertEquals(1001, JSONPath.eval(root, "/id"));
}
public void test_jsonpath() throws Exception {
Map<String, Object> root = new HashMap<String, Object>();
JSONPath.set(root, "/a/b/id", 1001);
Assert.assertEquals(1001, JSONPath.eval(root, "a/b/id"));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_toString.java
2 issues
Line: 11
import junit.framework.TestCase;
public class JSONPath_toString extends TestCase {
public void test_toJSONString() throws Exception {
Model model = new Model();
model.path = new JSONPath("$");
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"path\":\"$\"}", text);
Reported by PMD.
Line: 21
}
public static class Model {
public JSONPath path;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/TestSpecial_1.java
2 issues
Line: 12
public class TestSpecial_1 extends TestCase {
public void test_special() throws Exception {
String x = "{\"10.0.0.1\":{\"region\":\"xxx\"}}";
Object o = JSON.parse(x);
Assert.assertTrue(JSONPath.contains(o, "$.10\\.0\\.0\\.1"));
Assert.assertEquals("{\"region\":\"xxx\"}", JSONPath.eval(o, "$.10\\.0\\.0\\.1").toString());
Assert.assertTrue(JSONPath.contains(o, "$.10\\.0\\.0\\.1.region"));
Reported by PMD.
Line: 16
String x = "{\"10.0.0.1\":{\"region\":\"xxx\"}}";
Object o = JSON.parse(x);
Assert.assertTrue(JSONPath.contains(o, "$.10\\.0\\.0\\.1"));
Assert.assertEquals("{\"region\":\"xxx\"}", JSONPath.eval(o, "$.10\\.0\\.0\\.1").toString());
Assert.assertTrue(JSONPath.contains(o, "$.10\\.0\\.0\\.1.region"));
Assert.assertEquals("xxx", JSONPath.eval(o, "$.10\\.0\\.0\\.1.region"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_long.java
2 issues
Line: 10
public class TestASM_long extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
Reported by PMD.
Line: 15
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
}
public static class V0 {
private long i = 12;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_int.java
2 issues
Line: 10
public class TestASM_int extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
Reported by PMD.
Line: 15
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
}
public static class V0 {
private int i = 12;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_float.java
2 issues
Line: 11
public class TestASM_float extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertTrue(v.getValue() == v1.getValue());
Reported by PMD.
Line: 16
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertTrue(v.getValue() == v1.getValue());
}
public static class V0 {
private float value = 32.5F;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_double.java
2 issues
Line: 10
public class TestASM_double extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertTrue(v.getValue() == v1.getValue());
Reported by PMD.
Line: 15
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertTrue(v.getValue() == v1.getValue());
}
public static class V0 {
private double value = 32.5F;
Reported by PMD.