The following issues were found

src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumOrdinalTest.java
4 issues
System.out.println is used
Design

Line: 17

              
        int serializerFeatures = JSON.DEFAULT_GENERATE_FEATURE & ~SerializerFeature.WriteEnumUsingName.mask;
        String text = JSON.toJSONString(model, serializerFeatures);
        System.out.println(text);
    }

    public static class Model {
        public Type type;
    }

            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 17/03/2017.
 */
public class EnumOrdinalTest extends TestCase {
    public void test_enum_ordinal() throws Exception {
        Model model = new Model();
        model.type = Type.Big;

        int serializerFeatures = JSON.DEFAULT_GENERATE_FEATURE & ~SerializerFeature.WriteEnumUsingName.mask;
        String text = JSON.toJSONString(model, serializerFeatures);

            

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

               * Created by wenshao on 17/03/2017.
 */
public class EnumOrdinalTest extends TestCase {
    public void test_enum_ordinal() throws Exception {
        Model model = new Model();
        model.type = Type.Big;

        int serializerFeatures = JSON.DEFAULT_GENERATE_FEATURE & ~SerializerFeature.WriteEnumUsingName.mask;
        String text = JSON.toJSONString(model, serializerFeatures);

            

Reported by PMD.

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

Line: 21

                  }

    public static class Model {
        public Type type;
    }

    public static enum Type {
        Big, Medium, Small
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumTest4.java
4 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: 8

              import junit.framework.TestCase;

public class EnumTest4 extends TestCase {
    public void test_for_enum() throws Exception {
        assertEquals("101", JSON.toJSONString(Type.Big));
        assertEquals("101", JSON.toJSONString(Type1.Big));
    }

    public enum Type {

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 8

              import junit.framework.TestCase;

public class EnumTest4 extends TestCase {
    public void test_for_enum() throws Exception {
        assertEquals("101", JSON.toJSONString(Type.Big));
        assertEquals("101", JSON.toJSONString(Type1.Big));
    }

    public enum Type {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 9

              
public class EnumTest4 extends TestCase {
    public void test_for_enum() throws Exception {
        assertEquals("101", JSON.toJSONString(Type.Big));
        assertEquals("101", JSON.toJSONString(Type1.Big));
    }

    public enum Type {
        Big(101), Small(102);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 10

              public class EnumTest4 extends TestCase {
    public void test_for_enum() throws Exception {
        assertEquals("101", JSON.toJSONString(Type.Big));
        assertEquals("101", JSON.toJSONString(Type1.Big));
    }

    public enum Type {
        Big(101), Small(102);


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumUsingToString_JSONType.java
4 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

               * Created by wenshao on 17/03/2017.
 */
public class EnumUsingToString_JSONType extends TestCase {
    public void test_toString() {
        Model model = new Model();
        model.gender = Gender.M;

        String text = JSON.toJSONString(model);
        assertEquals("{\"gender\":\"男\"}", text);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      model.gender = Gender.M;

        String text = JSON.toJSONString(model);
        assertEquals("{\"gender\":\"男\"}", text);
    }

    @JSONType(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
    public static class Model {
        public Gender gender;

            

Reported by PMD.

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

Line: 23

              
    @JSONType(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
    public static class Model {
        public Gender gender;
    }

    public static enum Gender {
        M("男"),
        W("女");

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.annotation.JSONField'
Design

Line: 4

              package com.alibaba.json.bvt.serializer.enum_;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;

/**

            

Reported by PMD.

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

Line: 14

              
public class JSONPath_array_multi extends TestCase {

    Object[] list = new Object[10];

    public JSONPath_array_multi(){
        for (int i = 0; i < list.length; ++i) {
            list[i] = new Object();
        }

            

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

                      }
    }

    public void test_list_multi() throws Exception {
        List<Object> result = (List<Object>) new JSONPath("$[2,4,5,8,100]").eval(list);
        Assert.assertEquals(5, result.size());
        Assert.assertSame(list[2], result.get(0));
        Assert.assertSame(list[4], result.get(1));
        Assert.assertSame(list[5], result.get(2));

            

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

                      Assert.assertNull(result.get(4));
    }

    public void test_list_multi_negative() throws Exception {
        List<Object> result = (List<Object>) new JSONPath("$[-1,-2,-100]")
                .eval(list);
        Assert.assertEquals(3, result.size());
        Assert.assertSame(list[9], result.get(0));
        Assert.assertSame(list[8], result.get(1));

            

Reported by PMD.

Avoid unused imports such as 'java.util.ArrayList'
Design

Line: 3

              package com.alibaba.json.bvt.path;

import java.util.ArrayList;
import java.util.List;

import junit.framework.TestCase;

import org.junit.Assert;


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestByteField.java
4 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 WriteNonStringValueAsStringTestByteField extends TestCase {
    public void test_0() throws Exception {
        VO vo = new VO();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", 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: 19

                       Assert.assertEquals("{\"id\":\"100\"}", text);
    }
    
    public void test_1() throws Exception {
        V1 vo = new V1();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", text);

            

Reported by PMD.

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

Line: 28

                  }
    
    public static class VO {
        public byte id;
    }
    
    
    private static class V1 {
        public byte id;

            

Reported by PMD.

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

Line: 33

                  
    
    private static class V1 {
        public byte id;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestByteObjectField.java
4 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 WriteNonStringValueAsStringTestByteObjectField extends TestCase {
    public void test_0() throws Exception {
        VO vo = new VO();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", 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: 19

                       Assert.assertEquals("{\"id\":\"100\"}", text);
    }
    
    public void test_1() throws Exception {
        V1 vo = new V1();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", text);

            

Reported by PMD.

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

Line: 28

                  }
    
    public static class VO {
        public Byte id;
    }
    
    
    private static class V1 {
        public Byte id;

            

Reported by PMD.

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

Line: 33

                  
    
    private static class V1 {
        public Byte id;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestIntegerField.java
4 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 WriteNonStringValueAsStringTestIntegerField extends TestCase {
    public void test_0() throws Exception {
        VO vo = new VO();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", 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: 19

                       Assert.assertEquals("{\"id\":\"100\"}", text);
    }
    
    public void test_1() throws Exception {
        V1 vo = new V1();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
         Assert.assertEquals("{\"id\":\"100\"}", text);

            

Reported by PMD.

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

Line: 28

                  }
    
    public static class VO {
        public Integer id;
    }
    
    
    private static class V1 {
        public Integer id;

            

Reported by PMD.

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

Line: 33

                  
    
    private static class V1 {
        public Integer id;
    }
}

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class JSONPath_containsValue_bigdecimal extends TestCase {
    public void test_root() throws Exception {
        Model model = new Model();
        model.value = new BigDecimal("1001");
        
        Assert.assertTrue(JSONPath.containsValue(model, "/value", 1001));
        Assert.assertTrue(JSONPath.containsValue(model, "/value", 1001L));

            

Reported by PMD.

The String literal '/value' appears 6 times in this file; the first occurrence is on line 17
Error

Line: 17

                      Model model = new Model();
        model.value = new BigDecimal("1001");
        
        Assert.assertTrue(JSONPath.containsValue(model, "/value", 1001));
        Assert.assertTrue(JSONPath.containsValue(model, "/value", 1001L));
        Assert.assertTrue(JSONPath.containsValue(model, "/value", (short) 1001));
        
        Assert.assertFalse(JSONPath.containsValue(model, "/value", 1002));
        Assert.assertFalse(JSONPath.containsValue(model, "/value", 1002L));

            

Reported by PMD.

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

Line: 27

                  }
    
    public static class Model {
        public BigDecimal value;
    }
}

            

Reported by PMD.

Avoid unused imports such as 'java.math.BigInteger'
Design

Line: 4

              package com.alibaba.json.bvt.path;

import java.math.BigDecimal;
import java.math.BigInteger;

import org.junit.Assert;

import com.alibaba.fastjson.JSONPath;


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderScannerTest_boolean.java
4 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

              import com.alibaba.fastjson.parser.JSONReaderScanner;

public class JSONReaderScannerTest_boolean extends TestCase {
	public void test_true() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":true}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals(Boolean.TRUE, json.get("name"));
		parser.close();
	}

            

Reported by PMD.

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

Line: 15

              	public void test_true() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":true}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals(Boolean.TRUE, json.get("name"));
		parser.close();
	}
	
	public void test_false() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":false}"));

            

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

              		parser.close();
	}
	
	public void test_false() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":false}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals(Boolean.FALSE, json.get("name"));
		parser.close();
	}

            

Reported by PMD.

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

Line: 22

              	public void test_false() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":false}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals(Boolean.FALSE, json.get("name"));
		parser.close();
	}
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/filters/MTopFilterTest.java
4 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: 14

              
public class MTopFilterTest extends TestCase {

    public void test_0() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "yongbo";
        model.user = new Person();
        model.user.personId = 2002;

            

Reported by PMD.

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

Line: 41

                      Assert.assertEquals(model.user.personId, values.get("personId"));
    }

    public static class Model {

        private int    id;
        private String name;
        private Person user;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'valueFilter' (lines '22'-'39').
Error

Line: 22

                      model.user.personId = 2002;

        final HashMap<String, Object> values = new HashMap<String, Object>();
        ValueFilter valueFilter = new ValueFilter() {

            @Override
            public Object process(Object object, String name, Object value) {
                values.put(name, value);
                return value;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'valueFilter' (lines '22'-'39').
Error

Line: 22

                      model.user.personId = 2002;

        final HashMap<String, Object> values = new HashMap<String, Object>();
        ValueFilter valueFilter = new ValueFilter() {

            @Override
            public Object process(Object object, String name, Object value) {
                values.put(name, value);
                return value;

            

Reported by PMD.