The following issues were found

src/test/java/com/alibaba/json/bvt/TestFlase.java
3 issues
System.out.println is used
Design

Line: 11

              
    public void test_0() throws Exception {
        Object obj = JSON.parseObject("[{\"data\":{\"@type\":\"java.util.TreeMap\",false:21L},\"dataType\":2,\"dis\":0,\"length\":24,\"maxNum\":100,\"size\":3600000,\"version\":0}]", VO[].class);
        System.out.println(JSON.toJSONString(obj));
    }

    public static class VO {

        private Object data;

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 9

              
public class TestFlase extends TestCase {

    public void test_0() throws Exception {
        Object obj = JSON.parseObject("[{\"data\":{\"@type\":\"java.util.TreeMap\",false:21L},\"dataType\":2,\"dis\":0,\"length\":24,\"maxNum\":100,\"size\":3600000,\"version\":0}]", VO[].class);
        System.out.println(JSON.toJSONString(obj));
    }

    public static class VO {

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 9

              
public class TestFlase extends TestCase {

    public void test_0() throws Exception {
        Object obj = JSON.parseObject("[{\"data\":{\"@type\":\"java.util.TreeMap\",false:21L},\"dataType\":2,\"dis\":0,\"length\":24,\"maxNum\":100,\"size\":3600000,\"version\":0}]", VO[].class);
        System.out.println(JSON.toJSONString(obj));
    }

    public static class VO {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/TestNullKeyMap.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 12

              

public class TestNullKeyMap extends TestCase {
    public void test_0 () throws Exception {
        HashMap map = new HashMap();
        map.put(null, 123);
        
        String text = JSON.toJSONString(map);
        

            

Reported by PMD.

Avoid using implementation types like 'HashMap'; use the interface instead
Design

Line: 20

                      
        Assert.assertEquals("{null:123}", text);
        
        HashMap map2 = JSON.parseObject(text, HashMap.class);
        Assert.assertEquals(map.get(null), map2.get(null));
       
    }
}

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 21

                      Assert.assertEquals("{null:123}", text);
        
        HashMap map2 = JSON.parseObject(text, HashMap.class);
        Assert.assertEquals(map.get(null), map2.get(null));
       
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/TestSerializable.java
3 issues
JUnit tests should include assert() or fail()
Design

Line: 11

              import com.alibaba.fastjson.JSON;

public class TestSerializable extends TestCase {
    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.setValue(new ArrayList());
        
        JSON.toJSONString(vo);
    }

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

              import com.alibaba.fastjson.JSON;

public class TestSerializable extends TestCase {
    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.setValue(new ArrayList());
        
        JSON.toJSONString(vo);
    }

            

Reported by PMD.

The class 'VO' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=4, WMC=4)
Design

Line: 18

                      JSON.toJSONString(vo);
    }

    public static class VO {

        private long         id;
        private Serializable value;

        public long getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/UnQuoteFieldNamesTest.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 17

               * Created by wenshao on 11/01/2017.
 */
public class UnQuoteFieldNamesTest extends TestCase {
    public void test_for_issue() throws Exception {
        Map map = Collections.singletonMap("value", 123);

        String json = JSON.toJSONString(map
                , SerializeConfig.globalInstance
                , new SerializeFilter[0]

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

                              , null
                , JSON.DEFAULT_GENERATE_FEATURE & ~SerializerFeature.QuoteFieldNames.mask
        );
        assertEquals("{value:123}", json);
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 8

              import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import org.junit.Assert;

import java.util.Collections;
import java.util.Map;

/**

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/XX01.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 11

               * Created by wenshao on 14/08/2017.
 */
public class XX01 extends TestCase {
    public void test_for_xx() throws Exception {
        String text = "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}";
        JSONObject test = JSON.parseObject(text);

        String text2 = test.toJSONString();
        assertEquals("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}", text2);

            

Reported by PMD.

Potential violation of Law of Demeter (object not created locally)
Design

Line: 15

                      String text = "{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}";
        JSONObject test = JSON.parseObject(text);

        String text2 = test.toJSONString();
        assertEquals("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}", text2);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      JSONObject test = JSON.parseObject(text);

        String text2 = test.toJSONString();
        assertEquals("{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}:1}", text2);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectX.java
3 issues
The class 'ObjectX' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=16, WMC=16)
Design

Line: 9

              import java.util.List;


public class ObjectX {

	
	private long a = 0;
	
	private int b;

            

Reported by PMD.

Avoid using redundant field initializer for 'a'
Performance

Line: 12

              public class ObjectX {

	
	private long a = 0;
	
	private int b;

	
	private List<Integer> c;

            

Reported by PMD.

Avoid using redundant field initializer for 'd'
Performance

Line: 20

              	private List<Integer> c;

	
	private int d = 0;

	
	private int e;

	

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/annotation/JSONTypeAutoTypeCheckHandlerTest.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 9

              import junit.framework.TestCase;

public class JSONTypeAutoTypeCheckHandlerTest extends TestCase {
    public void test_for_checkAutoType() throws Exception {
        Cat cat = (Cat) JSON.parseObject("{\"@type\":\"Cat\",\"catId\":123}", Animal.class);
        assertEquals(123, cat.catId);
    }

    @JSONType(autoTypeCheckHandler = MyAutoTypeCheckHandler.class)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 11

              public class JSONTypeAutoTypeCheckHandlerTest extends TestCase {
    public void test_for_checkAutoType() throws Exception {
        Cat cat = (Cat) JSON.parseObject("{\"@type\":\"Cat\",\"catId\":123}", Animal.class);
        assertEquals(123, cat.catId);
    }

    @JSONType(autoTypeCheckHandler = MyAutoTypeCheckHandler.class)
    public static class Animal {


            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 20

                  }

    public static class Cat extends Animal {
        public int catId;
    }

    public static class Mouse extends Animal {

    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/annotation/SerializeUsingWhenString.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 17

               * @author by laugh on 16/9/28 12:08.
 */
public class SerializeUsingWhenString extends TestCase {
    public void test_annotation() throws Exception {
        Model model = new Model();
        model.value = "100";
        Assert.assertEquals("{\"value\":\"100元\"}", JSON.toJSONString(model));

        ModelWithOutJsonField modelWithOutJsonField = new ModelWithOutJsonField();

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 30

                  public static class Model {

        @JSONField(serializeUsing = ModelValueSerializer.class)
        public String value;
    }

    public static class ModelWithOutJsonField {

        public String value;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 35

              
    public static class ModelWithOutJsonField {

        public String value;
    }

    public static class ModelValueSerializer implements ObjectSerializer {

        public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue993.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 12

               * Created by wenshao on 15/01/2017.
 */
public class Issue993 extends TestCase {
    public void test_for_issue() throws Exception {
        Student student = new Student();
        student.name = "小刚";

        String json = JSON.toJSONString(student, SerializerFeature.WriteMapNullValue);
        assertEquals("{\"student_name\":\"小刚\",\"student_age\":0,\"student_grade\":null}", json);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      student.name = "小刚";

        String json = JSON.toJSONString(student, SerializerFeature.WriteMapNullValue);
        assertEquals("{\"student_name\":\"小刚\",\"student_age\":0,\"student_grade\":null}", json);
    }

    public static class Student {
        @JSONField(name="student_name",ordinal = 0)
        public String name;

            

Reported by PMD.

Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 22

              
    public static class Student {
        @JSONField(name="student_name",ordinal = 0)
        public String name;

        @JSONField(name="student_age",ordinal = 1)
        public int age;

        @JSONField(name="student_grade",ordinal = 2)

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/asm/TestNonASM.java
3 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 10

              
public class TestNonASM extends TestCase {

    public void test_no_asm() throws Exception {
        ParserConfig mapping = new ParserConfig();
        
        mapping.setAsmEnable(false);
        Assert.assertEquals(false, mapping.isAsmEnable());
        

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 20

                      Assert.assertEquals(true, mapping.isAsmEnable());
    }
    
    public void test_error() throws Exception {
        
    }
}

            

Reported by PMD.

JUnit tests should include assert() or fail()
Design

Line: 20

                      Assert.assertEquals(true, mapping.isAsmEnable());
    }
    
    public void test_error() throws Exception {
        
    }
}

            

Reported by PMD.