The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/deny/DenyTest6.java
8 issues
Line: 21
Exception error = null;
try {
Object obj = JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.deser.deny.DenyTest6$Model\"}", Object.class, config);
System.out.println(obj.getClass());
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 10
public class DenyTest6 extends TestCase {
public void test_autoTypeDeny() throws Exception {
ParserConfig config = new ParserConfig();
assertFalse(config.isAutoTypeSupport());
config.setAutoTypeSupport(true);
assertTrue(config.isAutoTypeSupport());
config.addDeny("com.alibaba.json.bvt.parser.deser.deny.DenyTest6");
Reported by PMD.
Line: 10
public class DenyTest6 extends TestCase {
public void test_autoTypeDeny() throws Exception {
ParserConfig config = new ParserConfig();
assertFalse(config.isAutoTypeSupport());
config.setAutoTypeSupport(true);
assertTrue(config.isAutoTypeSupport());
config.addDeny("com.alibaba.json.bvt.parser.deser.deny.DenyTest6");
Reported by PMD.
Line: 12
public void test_autoTypeDeny() throws Exception {
ParserConfig config = new ParserConfig();
assertFalse(config.isAutoTypeSupport());
config.setAutoTypeSupport(true);
assertTrue(config.isAutoTypeSupport());
config.addDeny("com.alibaba.json.bvt.parser.deser.deny.DenyTest6");
config.setAutoTypeSupport(false);
Reported by PMD.
Line: 14
ParserConfig config = new ParserConfig();
assertFalse(config.isAutoTypeSupport());
config.setAutoTypeSupport(true);
assertTrue(config.isAutoTypeSupport());
config.addDeny("com.alibaba.json.bvt.parser.deser.deny.DenyTest6");
config.setAutoTypeSupport(false);
Exception error = null;
try {
Reported by PMD.
Line: 21
Exception error = null;
try {
Object obj = JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.deser.deny.DenyTest6$Model\"}", Object.class, config);
System.out.println(obj.getClass());
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
Reported by PMD.
Line: 25
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
public static class Model {
}
Reported by PMD.
Line: 18
config.addDeny("com.alibaba.json.bvt.parser.deser.deny.DenyTest6");
config.setAutoTypeSupport(false);
Exception error = null;
try {
Object obj = JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.deser.deny.DenyTest6$Model\"}", Object.class, config);
System.out.println(obj.getClass());
} catch (JSONException ex) {
error = ex;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ProxyTest.java
8 issues
Line: 16
public class ProxyTest extends TestCase {
public void test_0() throws Exception {
A a = create(A.class);
a.setId(123);
Assert.assertEquals("{\"id\":123}", JSON.toJSONString(a));
}
Reported by PMD.
Line: 18
public void test_0() throws Exception {
A a = create(A.class);
a.setId(123);
Assert.assertEquals("{\"id\":123}", JSON.toJSONString(a));
}
public static <T> T create(Class<T> classs) throws Exception {
Reported by PMD.
Line: 23
Assert.assertEquals("{\"id\":123}", JSON.toJSONString(a));
}
public static <T> T create(Class<T> classs) throws Exception {
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(classs);
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
Reported by PMD.
Line: 29
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
public Object invoke(Object self, Method overridden, Method forwarder, Object[] args) throws Throwable {
return forwarder.invoke(self, args);
}
};
Object instance = clazz.newInstance();
((ProxyObject) instance).setHandler(handler);
Reported by PMD.
Line: 26
public static <T> T create(Class<T> classs) throws Exception {
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(classs);
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
public Object invoke(Object self, Method overridden, Method forwarder, Object[] args) throws Throwable {
return forwarder.invoke(self, args);
}
Reported by PMD.
Line: 26
public static <T> T create(Class<T> classs) throws Exception {
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(classs);
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
public Object invoke(Object self, Method overridden, Method forwarder, Object[] args) throws Throwable {
return forwarder.invoke(self, args);
}
Reported by PMD.
Line: 27
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(classs);
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
public Object invoke(Object self, Method overridden, Method forwarder, Object[] args) throws Throwable {
return forwarder.invoke(self, args);
}
};
Reported by PMD.
Line: 27
ProxyFactory factory = new ProxyFactory();
factory.setSuperclass(classs);
Class clazz = factory.createClass();
MethodHandler handler = new MethodHandler() {
public Object invoke(Object self, Method overridden, Method forwarder, Object[] args) throws Throwable {
return forwarder.invoke(self, args);
}
};
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/FieldDeserializerTest5.java
8 issues
Line: 10
public class FieldDeserializerTest5 extends TestCase {
public void test_0 () throws Exception {
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Reported by PMD.
Line: 11
public class FieldDeserializerTest5 extends TestCase {
public void test_0 () throws Exception {
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Reported by PMD.
Line: 12
public class FieldDeserializerTest5 extends TestCase {
public void test_0 () throws Exception {
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
Reported by PMD.
Line: 13
public void test_0 () throws Exception {
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
}
Reported by PMD.
Line: 14
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
}
Reported by PMD.
Line: 15
Assert.assertEquals(33, JSON.parseObject("{\"id\":33\t}\n\t", VO.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
}
public static class VO {
Reported by PMD.
Line: 16
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
}
public static class VO {
public int id;
Reported by PMD.
Line: 17
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 } ", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33 }\t\n", V1.class).id);
Assert.assertEquals(33, JSON.parseObject("{\"id\":33L}", V1.class).id);
}
public static class VO {
public int id;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/extract/JSONPath_extract_3.java
8 issues
Line: 8
public class JSONPath_extract_3 extends TestCase {
public void test_0() throws Exception {
assertEquals("male"
, JSONPath.extract(json, "$[0]['gender']")
.toString());
}
Reported by PMD.
Line: 9
public class JSONPath_extract_3 extends TestCase {
public void test_0() throws Exception {
assertEquals("male"
, JSONPath.extract(json, "$[0]['gender']")
.toString());
}
public void test_1() throws Exception {
Reported by PMD.
Line: 10
public void test_0() throws Exception {
assertEquals("male"
, JSONPath.extract(json, "$[0]['gender']")
.toString());
}
public void test_1() throws Exception {
assertNull(JSONPath.extract(json, "$[1]['gender']"));
Reported by PMD.
Line: 14
.toString());
}
public void test_1() throws Exception {
assertNull(JSONPath.extract(json, "$[1]['gender']"));
}
public void test_2() throws Exception {
assertEquals("ben"
Reported by PMD.
Line: 15
}
public void test_1() throws Exception {
assertNull(JSONPath.extract(json, "$[1]['gender']"));
}
public void test_2() throws Exception {
assertEquals("ben"
, JSONPath.extract(json, "$[1]['name']").toString());
Reported by PMD.
Line: 18
assertNull(JSONPath.extract(json, "$[1]['gender']"));
}
public void test_2() throws Exception {
assertEquals("ben"
, JSONPath.extract(json, "$[1]['name']").toString());
}
private static final String json = "[\n" +
Reported by PMD.
Line: 19
}
public void test_2() throws Exception {
assertEquals("ben"
, JSONPath.extract(json, "$[1]['name']").toString());
}
private static final String json = "[\n" +
" {\n" +
Reported by PMD.
Line: 20
public void test_2() throws Exception {
assertEquals("ben"
, JSONPath.extract(json, "$[1]['name']").toString());
}
private static final String json = "[\n" +
" {\n" +
" \"name\" : \"john\",\n" +
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/InnerClassDeser3.java
8 issues
Line: 13
* Created by wenshao on 25/03/2017.
*/
public class InnerClassDeser3 extends TestCase {
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
Reported by PMD.
Line: 13
* Created by wenshao on 25/03/2017.
*/
public class InnerClassDeser3 extends TestCase {
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
Reported by PMD.
Line: 15
public class InnerClassDeser3 extends TestCase {
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
public static class Model {
public Map<String, Item> items;
Reported by PMD.
Line: 16
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
public static class Model {
public Map<String, Item> items;
Reported by PMD.
Line: 16
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
public static class Model {
public Map<String, Item> items;
Reported by PMD.
Line: 16
public void test_for_inner_class() throws Exception {
Model model = JSON.parseObject("{\"items\":{\"123\":{\"id\":123}}}", Model.class);
assertNotNull(model.items);
assertEquals(123, model.items.get("123").id);
}
public static class Model {
public Map<String, Item> items;
Reported by PMD.
Line: 20
}
public static class Model {
public Map<String, Item> items;
public class Item {
public int id;
}
}
Reported by PMD.
Line: 6
import com.alibaba.fastjson.JSON;
import junit.framework.TestCase;
import java.util.List;
import java.util.Map;
/**
* Created by wenshao on 25/03/2017.
*/
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_field_wildcard_filter_double.java
8 issues
Line: 14
public class JSONPath_field_wildcard_filter_double extends TestCase {
public void test_list_map_0() throws Exception {
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score>0]");
assertEquals("[{\"score\":0.8951322155668501},{\"score\":0.7237896928683851},{\"score\":0.3467174233072834}]", JSON.toJSONString(array));
}
Reported by PMD.
Line: 18
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score>0]");
assertEquals("[{\"score\":0.8951322155668501},{\"score\":0.7237896928683851},{\"score\":0.3467174233072834}]", JSON.toJSONString(array));
}
public void test_list_map_1() throws Exception {
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Reported by PMD.
Line: 21
assertEquals("[{\"score\":0.8951322155668501},{\"score\":0.7237896928683851},{\"score\":0.3467174233072834}]", JSON.toJSONString(array));
}
public void test_list_map_1() throws Exception {
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score<0]");
assertEquals("[{\"score\":-0.3453003960431523}]", JSON.toJSONString(array));
}
Reported by PMD.
Line: 25
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score<0]");
assertEquals("[{\"score\":-0.3453003960431523}]", JSON.toJSONString(array));
}
public void test_list_map_2() throws Exception {
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Reported by PMD.
Line: 28
assertEquals("[{\"score\":-0.3453003960431523}]", JSON.toJSONString(array));
}
public void test_list_map_2() throws Exception {
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score=0]");
assertEquals("[{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0}]", JSON.toJSONString(array));
}
Reported by PMD.
Line: 32
Map<String, Value> jsonObject = JSON.parseObject(text, new TypeReference<Map<String, Value>>(){}, Feature.OrderedField);
Collection array = (Collection) JSONPath.eval(jsonObject, "$.*[score=0]");
assertEquals("[{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0},{\"score\":0.0}]", JSON.toJSONString(array));
}
public static class Value {
public double score;
}
Reported by PMD.
Line: 41
public static final String text = "{\n" +
"\t\"risk_sexy_trade_stream_plus\": {\n" +
"\t\t\"score\": 0\n" +
"\t},\n" +
"\t\"chemical_medicine_stream_plus\": {\n" +
"\t\t\"score\": 0\n" +
"\t},\n" +
"\t\"gambling_trade_stream_plus\": {\n" +
Reported by PMD.
Line: 42
public static final String text = "{\n" +
"\t\"risk_sexy_trade_stream_plus\": {\n" +
"\t\t\"score\": 0\n" +
"\t},\n" +
"\t\"chemical_medicine_stream_plus\": {\n" +
"\t\t\"score\": 0\n" +
"\t},\n" +
"\t\"gambling_trade_stream_plus\": {\n" +
"\t\t\"score\": 0\n" +
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/error/ParseErrorTest_9.java
8 issues
Line: 12
public class ParseErrorTest_9 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":33\"}", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 22
Assert.assertNotNull(error);
}
public void test_for_error_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 32
Assert.assertNotNull(error);
}
public void test_for_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\",", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 42
Assert.assertNotNull(error);
}
public void test_for_error_4() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"},", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 13
public class ParseErrorTest_9 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":33\"}", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 23
}
public void test_for_error_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 33
}
public void test_for_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\",", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 43
}
public void test_for_error_4() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"},", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldDoubleArrayTest.java
8 issues
Line: 10
* Created by wenshao on 11/01/2017.
*/
public class FieldDoubleArrayTest extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
Reported by PMD.
Line: 10
* Created by wenshao on 11/01/2017.
*/
public class FieldDoubleArrayTest extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
Reported by PMD.
Line: 12
public class FieldDoubleArrayTest extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
assertEquals(3.0D, model.value[2]);
}
Reported by PMD.
Line: 13
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
assertEquals(3.0D, model.value[2]);
}
Reported by PMD.
Line: 14
Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
assertEquals(3.0D, model.value[2]);
}
public static class Model {
Reported by PMD.
Line: 15
assertNotNull(model.value);
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
assertEquals(3.0D, model.value[2]);
}
public static class Model {
public double[] value;
Reported by PMD.
Line: 16
assertEquals(3, model.value.length);
assertEquals(1.0D, model.value[0]);
assertEquals(0.0D, model.value[1]);
assertEquals(3.0D, model.value[2]);
}
public static class Model {
public double[] value;
}
Reported by PMD.
Line: 20
}
public static class Model {
public double[] value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/error/ParseErrorTest_8.java
8 issues
Line: 12
public class ParseErrorTest_8 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":33\"}", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 22
Assert.assertNotNull(error);
}
public void test_for_error_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 32
Assert.assertNotNull(error);
}
public void test_for_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\",", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 42
Assert.assertNotNull(error);
}
public void test_for_error_4() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"},", Model.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 13
public class ParseErrorTest_8 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":33\"}", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 23
}
public void test_for_error_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 33
}
public void test_for_error_3() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\",", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 43
}
public void test_for_error_4() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"value\":\"33\"},", Model.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_Object.java
8 issues
Line: 14
public class WriteAsArray_Object extends TestCase {
public void test_0() throws Exception {
A a = new A();
a.setId(123);
a.setName("wenshao");
VO vo = new VO();
Reported by PMD.
Line: 26
Assert.assertEquals("[[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
private A a;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
private A a;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getA().getId(), vo2.getA().getId());
Assert.assertEquals(vo.getA().getName(), vo2.getA().getName());
}
private static class VO {
private A a;
Reported by PMD.
Line: 44
}
private static class A {
private int id;
private String name;
public int getId() {
Reported by PMD.