The following issues were found

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldIntArrayTest_private.java
8 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

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldIntArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    private static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    private static class Model {
        public int[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    private static class Model {
        public int[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    private static class Model {
        public int[] value;
    }
}

            

Reported by PMD.

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

              
public class ListSerializerTest extends TestCase {

    public void test_0_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();
        listSerializer.write(new JSONSerializer(out), Collections.EMPTY_LIST, null, null, 0);


            

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

                      Assert.assertEquals("[]", out.toString());
    }

    public void test_2_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1);

            

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

                      Assert.assertEquals("[1,2]", out.toString());
    }

    public void test_3_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1);

            

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

                      Assert.assertEquals("[1,2,3]", out.toString());
    }

    public void test_4_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

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

                      Assert.assertEquals("[1,2,3,{}]", out.toString());
    }

    public void test_5_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

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

                      Assert.assertEquals("[1,21474836480,null,{},21474836480]", out.toString());
    }

    public void test_6_s() throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

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

                      Assert.assertEquals("[1,\"1453964515792017682\"]", out.toString());
    }

    public void test_7_s() throws Exception {
        SerializeWriter out = new SerializeWriter(
                SerializerFeature.BrowserCompatible, SerializerFeature.WriteClassName
        );

        ListSerializer listSerializer = new ListSerializer();

            

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

                      Assert.assertEquals("[1L,1453964515792017682L]", out.toString());
    }

    public void test_8_s() throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.WriteClassName);

        ListSerializer listSerializer = new ListSerializer();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest13.java
8 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/02/2017.
 */
public class TypeReferenceTest13 extends TestCase {
    public void test_typeRef() throws Exception {
        String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);

            

Reported by PMD.

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

Line: 12

               * Created by wenshao on 09/02/2017.
 */
public class TypeReferenceTest13 extends TestCase {
    public void test_typeRef() throws Exception {
        String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);

            

Reported by PMD.

Avoid unused local variables such as 'searchResult'.
Design

Line: 16

                      String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);
            }
            {
                SearchResult<ResultItem1, CountFacet1> searchResult = parseSearchResult(
                        json, ResultItem1.class, CountFacet1.class);

            

Reported by PMD.

Avoid unused local variables such as 'searchResult'.
Design

Line: 20

                                      json, ResultItem.class, CountFacet.class);
            }
            {
                SearchResult<ResultItem1, CountFacet1> searchResult = parseSearchResult(
                        json, ResultItem1.class, CountFacet1.class);
            }
        }
    }


            

Reported by PMD.

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

Line: 50

              
    }

    public static class SearchResult<I, F> extends BaseResult {

        /**
         * 大的结果对象,包含结果数据、耗时、数量统计等信息
         */
        @JSONField(name = "result")

            

Reported by PMD.

Found 'DU'-anomaly for variable 'json' (lines '13'-'24').
Error

Line: 13

               */
public class TypeReferenceTest13 extends TestCase {
    public void test_typeRef() throws Exception {
        String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);
            }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'searchResult' (lines '16'-'24').
Error

Line: 16

                      String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);
            }
            {
                SearchResult<ResultItem1, CountFacet1> searchResult = parseSearchResult(
                        json, ResultItem1.class, CountFacet1.class);

            

Reported by PMD.

Found 'DD'-anomaly for variable 'searchResult' (lines '16'-'16').
Error

Line: 16

                      String json = "{\"result\":{}}";
        for (int i = 0; i < 100; ++i) {
            {
                SearchResult<ResultItem, CountFacet> searchResult = parseSearchResult(
                        json, ResultItem.class, CountFacet.class);
            }
            {
                SearchResult<ResultItem1, CountFacet1> searchResult = parseSearchResult(
                        json, ResultItem1.class, CountFacet1.class);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldIntArrayTest2.java
8 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

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest2 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, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest2 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, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldIntArrayTest2 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, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

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, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public int[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public int[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public int[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldIntArrayTest.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);

            

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

               * Created by wenshao on 11/01/2017.
 */
public class FieldIntArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldIntArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,2,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public int[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(2, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public int[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public int[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArrayTest_private.java
8 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

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldFloatArrayTest_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    private static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    private static class Model {
        public float[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    private static class Model {
        public float[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    private static class Model {
        public float[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/util/FieldInfoTest.java
7 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: 16

              import junit.framework.TestCase;

public class FieldInfoTest extends TestCase {
    public void test_null() throws Exception {
        FieldInfo fieldInfo = new FieldInfo("getValue", Entity.class.getMethod("getValue"), null, null, null, 0, 0, 0, null, null, null);
        Assert.assertEquals(null, fieldInfo.getAnnotation());

        Field field = GenericFieldEntity.class.getField("value");
        Type type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericFieldEntity.class);

            

Reported by PMD.

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

Line: 20

                      FieldInfo fieldInfo = new FieldInfo("getValue", Entity.class.getMethod("getValue"), null, null, null, 0, 0, 0, null, null, null);
        Assert.assertEquals(null, fieldInfo.getAnnotation());

        Field field = GenericFieldEntity.class.getField("value");
        Type type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericFieldEntity.class);
        FieldInfo fieldInfoOfField = new FieldInfo("value", null, field, GenericFieldEntity.class, type, 0, 0, 0, null, null, null);
        Assert.assertEquals(fieldInfoOfField.fieldType, ValueObject.class);
        Assert.assertEquals(fieldInfoOfField.fieldClass, ValueObject.class);


            

Reported by PMD.

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

Line: 30

                      type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericListFieldEntity.class);
        FieldInfo fieldInfoOfListField = new FieldInfo("value", null, field, GenericListFieldEntity.class, type, 0, 0, 0, null, null, null);
        ParameterizedTypeImpl actualFieldType = (ParameterizedTypeImpl) fieldInfoOfListField.fieldType;
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListField.fieldClass, List.class);
        Assert.assertEquals(null, ((ParameterizedTypeImpl) type).getOwnerType());

        Method method = GenericSetterEntity.class.getMethod("setValue", Object.class);

            

Reported by PMD.

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

Line: 31

                      FieldInfo fieldInfoOfListField = new FieldInfo("value", null, field, GenericListFieldEntity.class, type, 0, 0, 0, null, null, null);
        ParameterizedTypeImpl actualFieldType = (ParameterizedTypeImpl) fieldInfoOfListField.fieldType;
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListField.fieldClass, List.class);
        Assert.assertEquals(null, ((ParameterizedTypeImpl) type).getOwnerType());

        Method method = GenericSetterEntity.class.getMethod("setValue", Object.class);
        type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericSetterEntity.class);

            

Reported by PMD.

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

Line: 46

                      method = GenericListSetterEntity.class.getMethod("setValue", List.class);
        type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericListSetterEntity.class);
        FieldInfo fieldInfoOfListSetter = new FieldInfo("value", method, null, GenericListSetterEntity.class, type, 0, 0, 0, null, null, null);
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListSetter.fieldClass, List.class);
    }

    public static class Entity {

            

Reported by PMD.

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

Line: 47

                      type = new ParameterizedTypeImpl(new Type[] { ValueObject.class }, null, GenericListSetterEntity.class);
        FieldInfo fieldInfoOfListSetter = new FieldInfo("value", method, null, GenericListSetterEntity.class, type, 0, 0, 0, null, null, null);
        Assert.assertEquals(actualFieldType.getActualTypeArguments()[0], ValueObject.class);
        Assert.assertEquals(actualFieldType.getRawType(), List.class);
        Assert.assertEquals(fieldInfoOfListSetter.fieldClass, List.class);
    }

    public static class Entity {
        private int value;

            

Reported by PMD.

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

Line: 95

                      public List<T> value;
    }

    public static class ValueObject {
        private String name;
        private int    id;

        public String getName() {
            return name;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/BigDecimalTest.java
7 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.serializer.SerializerFeature;

public class BigDecimalTest extends TestCase {
    public void test_null () throws Exception {
        Assert.assertNull(JSON.parseObject("null", VO.class));
        Assert.assertNull(JSON.parseObject("{value:null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{'value':null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{\"value\":null}", VO.class).getValue());
        Assert.assertNull(JSON.parseArray("null", BigDecimal.class));

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 14

              public class BigDecimalTest extends TestCase {
    public void test_null () throws Exception {
        Assert.assertNull(JSON.parseObject("null", VO.class));
        Assert.assertNull(JSON.parseObject("{value:null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{'value':null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{\"value\":null}", VO.class).getValue());
        Assert.assertNull(JSON.parseArray("null", BigDecimal.class));
        Assert.assertNull(JSON.parseObject("null", BigDecimal.class));
    }

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 15

                  public void test_null () throws Exception {
        Assert.assertNull(JSON.parseObject("null", VO.class));
        Assert.assertNull(JSON.parseObject("{value:null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{'value':null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{\"value\":null}", VO.class).getValue());
        Assert.assertNull(JSON.parseArray("null", BigDecimal.class));
        Assert.assertNull(JSON.parseObject("null", BigDecimal.class));
    }
    

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 16

                      Assert.assertNull(JSON.parseObject("null", VO.class));
        Assert.assertNull(JSON.parseObject("{value:null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{'value':null}", VO.class).getValue());
        Assert.assertNull(JSON.parseObject("{\"value\":null}", VO.class).getValue());
        Assert.assertNull(JSON.parseArray("null", BigDecimal.class));
        Assert.assertNull(JSON.parseObject("null", BigDecimal.class));
    }
    
    public void test_postfix () 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: 21

                      Assert.assertNull(JSON.parseObject("null", BigDecimal.class));
    }
    
    public void test_postfix () throws Exception {
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123L", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123D", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123F", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123S", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123B", BigDecimal.class));

            

Reported by PMD.

The String literal '123' appears 7 times in this file; the first occurrence is on line 22
Error

Line: 22

                  }
    
    public void test_postfix () throws Exception {
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123L", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123D", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123F", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123S", BigDecimal.class));
        Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123B", BigDecimal.class));
    }

            

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

                      Assert.assertEquals(new BigDecimal ("123"), JSON.parseObject("123B", BigDecimal.class));
    }
    
    public void test_className() throws Exception {
        Assert.assertEquals("123.", JSON.toJSONString(new BigDecimal("123"), SerializerFeature.WriteClassName));
        Assert.assertEquals("123.00", JSON.toJSONString(new BigDecimal("123.00"), SerializerFeature.WriteClassName));
        Assert.assertEquals("123.45", JSON.toJSONString(new BigDecimal("123.45"), SerializerFeature.WriteClassName));
        Assert.assertEquals(new BigDecimal("123"), JSON.parse("123."));
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_paths_test2.java
7 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 junit.framework.TestCase;

public class JSONPath_paths_test2 extends TestCase {
    public void test_map() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "wenshao";
        
        

            

Reported by PMD.

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

Line: 20

                      
        Map<String, Object> paths = JSONPath.paths(model);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(model, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
    

            

Reported by PMD.

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

Line: 21

                      Map<String, Object> paths = JSONPath.paths(model);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(model, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
    
    public static class Model {

            

Reported by PMD.

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

Line: 22

                      
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(model, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
    
    public static class Model {
        public int id;

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(3, paths.size());
        Assert.assertSame(model, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
    
    public static class Model {
        public int id;
        public String name;

            

Reported by PMD.

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

Line: 27

                  }
    
    public static class Model {
        public int id;
        public String name;
    }
}

            

Reported by PMD.

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

Line: 28

                  
    public static class Model {
        public int id;
        public String name;
    }
}

            

Reported by PMD.

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

Line: 18

                      entity.getChild().setParent(entity);

        String text = JSON.toJSONString(entity);
        System.out.println(text);

        Entity entity2 = JSON.parseObject(text, Entity.class);

        Assert.assertEquals(entity2, entity2.getChild().getParent());


            

Reported by PMD.

System.out.println is used
Design

Line: 24

              
        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

        private final int   id;

            

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

              
public class RefTest13 extends TestCase {

    public void test_0() throws Exception {
        Entity entity = new Entity(123, new Child());
        entity.getChild().setParent(entity);

        String text = JSON.toJSONString(entity);
        System.out.println(text);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 15

              
    public void test_0() throws Exception {
        Entity entity = new Entity(123, new Child());
        entity.getChild().setParent(entity);

        String text = JSON.toJSONString(entity);
        System.out.println(text);

        Entity entity2 = JSON.parseObject(text, Entity.class);

            

Reported by PMD.

Potential violation of Law of Demeter (method chain calls)
Design

Line: 22

              
        Entity entity2 = JSON.parseObject(text, Entity.class);

        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

            

Reported by PMD.

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

Line: 22

              
        Entity entity2 = JSON.parseObject(text, Entity.class);

        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.parser.ParserConfig'
Design

Line: 9

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.parser.ParserConfig;

public class RefTest13 extends TestCase {

    public void test_0() throws Exception {
        Entity entity = new Entity(123, new Child());

            

Reported by PMD.