The following issues were found

src/test/java/com/alibaba/json/bvt/path/JSONPath_array_remove_0.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 09/03/2017.
 */
public class JSONPath_array_remove_0 extends TestCase {
    public void test_remove() throws Exception {
        JSONObject jsonObject = new JSONObject();

        JSONArray array = new JSONArray();
        for (int i = 0; i < 10; ++i) {
            JSONObject item = new JSONObject();

            

Reported by PMD.

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

Line: 12

               * Created by wenshao on 09/03/2017.
 */
public class JSONPath_array_remove_0 extends TestCase {
    public void test_remove() throws Exception {
        JSONObject jsonObject = new JSONObject();

        JSONArray array = new JSONArray();
        for (int i = 0; i < 10; ++i) {
            JSONObject item = new JSONObject();

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 17

              
        JSONArray array = new JSONArray();
        for (int i = 0; i < 10; ++i) {
            JSONObject item = new JSONObject();
            item.put("age", i);
            array.add(item);
        }
        jsonObject.put("aaa", array);


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest3.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

              
public class RefTest3 extends TestCase {
    
    public void test_ref() throws Exception {
        Object[] array = new Object[1];
        array[0] = array;
        Assert.assertEquals("[{\"$ref\":\"@\"}]", JSON.toJSONString(array));
    }
    

            

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: 17

                      Assert.assertEquals("[{\"$ref\":\"@\"}]", JSON.toJSONString(array));
    }
    
    public void test_parse() throws Exception {
        Object[] array2 = JSON.parseObject("[{\"$ref\":\"$\"}]", Object[].class);
        Assert.assertSame(array2, array2[0]);
    }
    
    public void test_parse_1() throws Exception {

            

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: 22

                      Assert.assertSame(array2, array2[0]);
    }
    
    public void test_parse_1() throws Exception {
        Object[] array2 = JSON.parseObject("[{\"$ref\":\"@\"}]", Object[].class);
        Assert.assertSame(array2, array2[0]);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/generic/GenericArrayTest3.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 GenericArrayTest3 extends TestCase {
    
    public void test_generic() throws Exception {
        VO vo = new VO();
        vo.values = new Pair[] {null, null};
        
        String text = JSON.toJSONString(vo);
//        VO vo1 = JSON.parseObject(text, new TypeReference<VO<Number, String>>(){} );

            

Reported by PMD.

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

Line: 26

                  }

    public static class A<T extends Number, S> {
        public Pair<T, S>[] values;
    }
    
    public static class VO extends A<Number, String> {
        
    }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.TypeReference'
Design

Line: 6

              import org.junit.Assert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import junit.framework.TestCase;

public class GenericArrayTest3 extends TestCase {
    

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest20.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

              import junit.framework.TestCase;

public class RefTest20 extends TestCase {
    public void test_array() throws Exception {
        String text = "{\"resultObj\":{\"appId\":1161605300000000588,\"inputParamList\":[],\"obj\":{\"$ref\":\"$.resultObj\"}}}";
        
        JSONObject obj = JSON.parseObject(text);
        JSONObject resultObj = obj.getJSONObject("resultObj");
        Assert.assertSame(resultObj, resultObj.get("obj"));

            

Reported by PMD.

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

Line: 15

                      String text = "{\"resultObj\":{\"appId\":1161605300000000588,\"inputParamList\":[],\"obj\":{\"$ref\":\"$.resultObj\"}}}";
        
        JSONObject obj = JSON.parseObject(text);
        JSONObject resultObj = obj.getJSONObject("resultObj");
        Assert.assertSame(resultObj, resultObj.get("obj"));
    }
}

            

Reported by PMD.

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

Line: 16

                      
        JSONObject obj = JSON.parseObject(text);
        JSONObject resultObj = obj.getJSONObject("resultObj");
        Assert.assertSame(resultObj, resultObj.get("obj"));
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest19.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

              import junit.framework.TestCase;

public class RefTest19 extends TestCase {
    public void test_array() throws Exception {
        String text = "{\"b\":{},\"a\":{\"$ref\":\"$.b\"}}";
        
        JSONObject obj = JSON.parseObject(text);
        JSONObject a = obj.getJSONObject("a");
        JSONObject b = obj.getJSONObject("b");

            

Reported by PMD.

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

Line: 15

                      String text = "{\"b\":{},\"a\":{\"$ref\":\"$.b\"}}";
        
        JSONObject obj = JSON.parseObject(text);
        JSONObject a = obj.getJSONObject("a");
        JSONObject b = obj.getJSONObject("b");
        Assert.assertSame(a, b);
    }
}

            

Reported by PMD.

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

Line: 16

                      
        JSONObject obj = JSON.parseObject(text);
        JSONObject a = obj.getJSONObject("a");
        JSONObject b = obj.getJSONObject("b");
        Assert.assertSame(a, b);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/features/WriteBigDecimalAsPlainTest.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: 15

               * Created by wenshao on 16/8/9.
 */
public class WriteBigDecimalAsPlainTest extends TestCase {
    public void test_for_feature() throws Exception {
        BigDecimal value = new BigDecimal("0.00000001");

        Assert.assertEquals("1E-8", JSON.toJSONString(value));
        Assert.assertEquals("0.00000001", JSON.toJSONString(value, SerializerFeature.WriteBigDecimalAsPlain));
    }

            

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: 22

                      Assert.assertEquals("0.00000001", JSON.toJSONString(value, SerializerFeature.WriteBigDecimalAsPlain));
    }

    public void test_1() throws Exception {
        Model m = new Model();
        m.value = new BigDecimal("0.00000001");

        Assert.assertEquals("{\"value\":1E-8}", JSON.toJSONString(m));
        Assert.assertEquals("{\"value\":0.00000001}", JSON.toJSONString(m, SerializerFeature.WriteBigDecimalAsPlain));

            

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: 30

                      Assert.assertEquals("{\"value\":0.00000001}", JSON.toJSONString(m, SerializerFeature.WriteBigDecimalAsPlain));
    }

    public void test_for_feature_BigInteger() throws Exception {
        BigInteger value = new BigInteger("2020020700826004000000000000");

        Assert.assertEquals("2020020700826004000000000000", JSON.toJSONString(value));
        Assert.assertEquals("2020020700826004000000000000", JSON.toJSONString(value, SerializerFeature.WriteBigDecimalAsPlain));
    }

            

Reported by PMD.

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

Line: 35

                      d.add(c);
        
        String text = JSON.toJSONString(a);
        System.out.println(text);
    }
}

            

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: 12

              

public class RefTest15 extends TestCase {
    public void test_0 () throws Exception {
        List<Object> a = new ArrayList<Object>();
        List<Object> b = new ArrayList<Object>();
        List<Object> c = new ArrayList<Object>();
        List<Object> d = new ArrayList<Object>();
        

            

Reported by PMD.

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

Line: 12

              

public class RefTest15 extends TestCase {
    public void test_0 () throws Exception {
        List<Object> a = new ArrayList<Object>();
        List<Object> b = new ArrayList<Object>();
        List<Object> c = new ArrayList<Object>();
        List<Object> d = new ArrayList<Object>();
        

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPointTest_1.java
3 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 12

              
public class JSONPointTest_1 extends TestCase {

    private Object json;

    protected void setUp() throws Exception {
        String text = "[{\"name\":\"ljw\",\"age\":123}]";
        json = JSON.parse(text);
    }

            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 14

              
    private Object json;

    protected void setUp() throws Exception {
        String text = "[{\"name\":\"ljw\",\"age\":123}]";
        json = JSON.parse(text);
    }

    

            

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

                  }

    
    public void test_key_1() throws Exception {
        Object val = JSONPath.eval(json, "/0/name");
        Assert.assertEquals("ljw", val);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_null.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: 13

              
public class TestASM_null extends TestCase {

    public void test_null() throws Exception {
        List<VO> list = JSON.parseArray("[{\"f1\":\"v1\",\"f2\":\"v2\"},{\"f2\":\"v2\",\"f3\":\"v3\"},{\"f2\":\"v2\",\"f3\":\"v3\"},{\"f1\":\"v1\",\"f3\":\"v3\"}]", VO.class);
        String text = JSON.toJSONString(list, SerializerFeature.UseSingleQuotes);
        Assert.assertEquals("[{'f1':'v1','f2':'v2'},{'f2':'v2','f3':'v3'},{'f2':'v2','f3':'v3'},{'f1':'v1','f3':'v3'}]", text);
//        System.out.println(text);
    }

            

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

              //        System.out.println(text);
    }
    
    public void test_null_notmatch() throws Exception {
        List<VO> list = JSON.parseArray("[{\"f3\":\"v3\",\"f2\":\"v2\",\"f1\":\"v1\"}]", VO.class);
        String text = JSON.toJSONString(list, SerializerFeature.UseSingleQuotes);
        Assert.assertEquals("[{'f1':'v1','f2':'v2','f3':'v3'}]", text);
//        System.out.println(text);
    }

            

Reported by PMD.

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

Line: 28

                  }
    

    public static class VO {

        private String f1;
        private String f2;
        private String f3;


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_object_filter.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

              

public class JSONPath_object_filter extends TestCase {
    public void test_object_filter() throws Exception {
        JSONPath path = new JSONPath("[id=123]");
        
        Entity entity = new Entity(123, "ljw2083");
        Assert.assertSame(entity, path.eval(entity));
    }

            

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: 19

                  }
    

    public void test_object_filter_not_match() throws Exception {
        JSONPath path = new JSONPath("[id=124]");
        
        Entity entity = new Entity(123, "ljw2083");
        Assert.assertNull(path.eval(entity));
    }

            

Reported by PMD.

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

Line: 26

                      Assert.assertNull(path.eval(entity));
    }

    public static class Entity {

        private Integer id;
        private String  name;

        public Entity(Integer id, String name){

            

Reported by PMD.