The following issues were found
src/test/java/com/alibaba/json/bvt/DoubleArrayFieldTest_primitive.java
6 issues
Line: 12
public class DoubleArrayFieldTest_primitive extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 23
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 26
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 41
private double[] value;
public double[] getValue() {
return value;
}
public void setValue(double[] value) {
this.value = value;
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(double[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(double[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/DoubleFieldTest_A.java
6 issues
Line: 19
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
Reported by PMD.
Line: 33
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
Reported by PMD.
Line: 12
public class DoubleFieldTest_A extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(1001D);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 23
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 26
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 37
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public static class User {
private Double value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FloatArrayFieldTest_primitive.java
6 issues
Line: 12
public class FloatArrayFieldTest_primitive extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 23
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 26
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 41
private float[] value;
public float[] getValue() {
return value;
}
public void setValue(float[] value) {
this.value = value;
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(float[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(float[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FloatFieldTest_A.java
6 issues
Line: 19
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
Reported by PMD.
Line: 33
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
String text = JSON.toJSONString(user, mapping, SerializerFeature.WriteMapNullValue);
System.out.println(text);
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
Reported by PMD.
Line: 12
public class FloatFieldTest_A extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(1001F);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 23
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 26
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 37
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public static class User {
private Float value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONArrayTest3.java
6 issues
Line: 12
import junit.framework.TestCase;
public class JSONArrayTest3 extends TestCase {
public void test_0() throws Exception {
JSONArray array = new JSONArray();
array.set(1, "1001");
Assert.assertEquals(2, array.size());
Assert.assertNull(array.get(0));
Assert.assertEquals("1001", array.get(1));
Reported by PMD.
Line: 14
public class JSONArrayTest3 extends TestCase {
public void test_0() throws Exception {
JSONArray array = new JSONArray();
array.set(1, "1001");
Assert.assertEquals(2, array.size());
Assert.assertNull(array.get(0));
Assert.assertEquals("1001", array.get(1));
array.clear();
Reported by PMD.
Line: 26
Assert.assertEquals(1, array.size());
Assert.assertEquals("1001", array.get(0));
array.fluentAdd("1002").fluentClear();
Assert.assertEquals(0, array.size());
array.fluentAdd("1002").fluentRemove("1002");
Assert.assertEquals(0, array.size());
Reported by PMD.
Line: 26
Assert.assertEquals(1, array.size());
Assert.assertEquals("1001", array.get(0));
array.fluentAdd("1002").fluentClear();
Assert.assertEquals(0, array.size());
array.fluentAdd("1002").fluentRemove("1002");
Assert.assertEquals(0, array.size());
Reported by PMD.
Line: 29
array.fluentAdd("1002").fluentClear();
Assert.assertEquals(0, array.size());
array.fluentAdd("1002").fluentRemove("1002");
Assert.assertEquals(0, array.size());
array.fluentAdd("1002").fluentRemove(0);
Assert.assertEquals(0, array.size());
Reported by PMD.
Line: 32
array.fluentAdd("1002").fluentRemove("1002");
Assert.assertEquals(0, array.size());
array.fluentAdd("1002").fluentRemove(0);
Assert.assertEquals(0, array.size());
array.fluentSet(1, "1001");
Assert.assertEquals(2, array.size());
Assert.assertNull(array.get(0));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONTest3.java
6 issues
Line: 15
import junit.framework.TestCase;
public class JSONTest3 extends TestCase {
public void test_json() throws Exception {
ExtraProcessor extraProcessor = new ExtraProcessor() {
public void processExtra(Object object, String key, Object value) {
Model model = (Model) object;
model.attributes.put(key, value);
Reported by PMD.
Line: 20
public void processExtra(Object object, String key, Object value) {
Model model = (Model) object;
model.attributes.put(key, value);
}
};
Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
Assert.assertEquals(1, model.attributes.size());
Reported by PMD.
Line: 25
};
Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
Assert.assertEquals(1, model.attributes.size());
Assert.assertEquals(1001, model.attributes.get("id"));
}
public static class Model {
private Map<String, Object> attributes = new HashMap<String, Object>();
Reported by PMD.
Line: 26
Model model = JSON.parseObject("{\"id\":1001}", (Type) Model.class, extraProcessor);
Assert.assertEquals(1, model.attributes.size());
Assert.assertEquals(1001, model.attributes.get("id"));
}
public static class Model {
private Map<String, Object> attributes = new HashMap<String, Object>();
}
Reported by PMD.
Line: 30
}
public static class Model {
private Map<String, Object> attributes = new HashMap<String, Object>();
}
}
Reported by PMD.
Line: 30
}
public static class Model {
private Map<String, Object> attributes = new HashMap<String, Object>();
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONTypeTest.java
6 issues
Line: 10
import com.alibaba.fastjson.annotation.JSONType;
public class JSONTypeTest extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.setId(1001);
vo.setName("xx");
vo.setAge(33);
Reported by PMD.
Line: 20
JSON.toJSONString(vo));
}
public void test_1() throws Exception {
V1 vo = new V1();
vo.setId(1001);
vo.setName("xx");
vo.setAge(33);
Reported by PMD.
Line: 30
JSON.toJSONString(vo));
}
public void test_2() throws Exception {
V1 vo = new V1();
vo.setId(1001);
vo.setName("xx");
vo.setAge(33);
Reported by PMD.
Line: 41
}
@JSONType
public static class VO {
private int id;
private String name;
private int age;
public int getId() {
Reported by PMD.
Line: 72
}
@JSONType(orders = { "id", "name", "age" })
public static class V1 {
private int id;
private String name;
private int age;
public int getId() {
Reported by PMD.
Line: 103
}
@JSONType(orders = { "id", "name", "age" },asm=false)
private class V2 {
private int id;
private String name;
private int age;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/JSONTypeTest1.java
6 issues
Line: 11
public class JSONTypeTest1 extends TestCase {
public void test_ignores() throws Exception {
A a = new A();
a.setF1(1001);
a.setF2(1002);
a.setF3(1003);
Reported by PMD.
Line: 20
Assert.assertEquals("{\"f1\":1001,\"f3\":1003}", JSON.toJSONString(a));
}
public void test_ignoresParent() throws Exception {
B b = new B();
b.setF1(1001);
b.setF2(1002);
b.setF3(1003);
b.setF4(1004);
Reported by PMD.
Line: 31
Assert.assertEquals("{\"f1\":1001,\"f3\":1003,\"f5\":1005}", JSON.toJSONString(b));
}
public void test_ignoresParent2() throws Exception {
C c = new C();
c.setF1(1001);
c.setF2(1002);
c.setF3(1003);
c.setF4(1004);
Reported by PMD.
Line: 43
Assert.assertEquals("{\"f1\":1001,\"f3\":1003,\"f5\":1005,\"f6\":1006}", JSON.toJSONString(c));
}
public void test_ignoresParent3() throws Exception {
D d = new D();
d.setF1(1001);
d.setF2(1002);
d.setF3(1003);
d.setF4(1004);
Reported by PMD.
Line: 57
}
@JSONType(ignores = "f2")
public static class A {
private int f1;
private int f2;
private int f3;
Reported by PMD.
Line: 90
}
@JSONType(ignores = { "f4" })
public static class B extends A {
private int f4;
private int f5;
public int getF4() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/LinkedListFieldTest.java
6 issues
Line: 14
public class LinkedListFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 28
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 42
public static class V0 {
private LinkedList value;
public LinkedList getValue() {
return value;
}
Reported by PMD.
Line: 44
private LinkedList value;
public LinkedList getValue() {
return value;
}
public void setValue(LinkedList value) {
this.value = value;
Reported by PMD.
Line: 48
return value;
}
public void setValue(LinkedList value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/LongArrayFieldTest.java
6 issues
Line: 12
public class LongArrayFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 23
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 26
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 41
private Long[] value;
public Long[] getValue() {
return value;
}
public void setValue(Long[] value) {
this.value = value;
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(Long[] value) {
this.value = value;
}
}
}
Reported by PMD.
Line: 44
return value;
}
public void setValue(Long[] value) {
this.value = value;
}
}
}
Reported by PMD.