The following issues were found

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

Line: 34

              
        String text = JSON.toJSONString(user);
        Assert.assertEquals("{\"name\":\"毛头\",\"uid\":123}", text);
        System.out.println(text);
    }
}

            

Reported by PMD.

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

Line: 11

              
public class JSONFeidDemo extends TestCase {

    public static class User {

        private int    id;
        private String name;

        @JSONField(name = "uid")

            

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

                      public void setName(String name) { this.name = name; }
    }

    public void test_0() throws Exception {
        User user = new User();
        user.setId(123);
        user.setName("毛头");

        String text = JSON.toJSONString(user);

            

Reported by PMD.

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

              import java.util.Map;

public class BigDecimal_BrowserCompatible extends TestCase {
    public void test_for_issue() throws Exception {
        Map<String, Object> map = new LinkedHashMap<String, Object>();
        map.put("id1", new BigDecimal("-9223370018640066466"));
        map.put("id2", new BigDecimal("9223370018640066466"));
        map.put("id3", new BigDecimal("100"));
        assertEquals("{\"id1\":\"-9223370018640066466\",\"id2\":\"9223370018640066466\",\"id3\":100}",

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      map.put("id1", new BigDecimal("-9223370018640066466"));
        map.put("id2", new BigDecimal("9223370018640066466"));
        map.put("id3", new BigDecimal("100"));
        assertEquals("{\"id1\":\"-9223370018640066466\",\"id2\":\"9223370018640066466\",\"id3\":100}",
                JSON.toJSONString(map, SerializerFeature.BrowserCompatible)
        );
    }
}

            

Reported by PMD.

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

Line: 8

              import junit.framework.TestCase;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.LinkedHashMap;
import java.util.Map;

public class BigDecimal_BrowserCompatible extends TestCase {
    public void test_for_issue() throws Exception {

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class JSONTypeTest_orders_arrayMapping_2 extends TestCase {
	public void test_1() throws Exception {
		Model vo = new Model();
		vo.setId(1001);
		vo.setName("xx");
		vo.setAge(33);
		vo.setDvalue(0.1D);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

              		vo.setDvalue(0.1D);

		String json = JSON.toJSONString(vo);
		assertEquals("[1001,\"xx\",33,0.0,0.1]", json);

		JSON.parseObject(json, Model.class);

		Model[] array = new Model[] {vo};
		String json2 = JSON.toJSONString(array);

            

Reported by PMD.

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

Line: 34

              			, serialzeFeatures = SerializerFeature.BeanToArray
			, parseFeatures = Feature.SupportArrayToBean
	)
	public static class Model {
		private int id;
		private String name;
		private int age;
		private float value;
		private double dvalue;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ByteArrayFieldTest_5_base64.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 ByteArrayFieldTest_5_base64 extends TestCase {

    public void test_0() throws Exception {
        Model model = new Model();

        model.value = "ABCDEG".getBytes();

        String json = JSON.toJSONString(model);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

              
        String json = JSON.toJSONString(model);

        assertEquals("{\"value\":\"QUJDREVH\"}", json);

        Model model1 = JSON.parseObject(json, Model.class);
        Assert.assertArrayEquals(model.value, model1.value);
    }


            

Reported by PMD.

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

Line: 26

                  private static class Model {

        @JSONField(format = "base64")
        public byte[] value;


    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/JSON_toJSONStringTest.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: 29

              
public class JSON_toJSONStringTest extends TestCase {

    public void test_0() throws Exception {
        User user = new User();
        user.setId(123);
        user.setName("毛头");

        SerializeConfig mapping = new SerializeConfig();

            

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

                      Assert.assertEquals("{\"id\":123}", jsonString);
    }

    public void test_1() throws Exception {
        User user = new User();
        user.setId(123);
        user.setName("毛头");

        SerializeConfig mapping = new SerializeConfig();

            

Reported by PMD.

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

Line: 59

                      Assert.assertEquals("{\"uid\":123}", jsonString);
    }

    public static class User {

        private int    id;
        private String name;

        public int getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/BigIntegerFieldTest.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: 14

              
public class BigIntegerFieldTest extends TestCase {

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

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.

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

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.

src/test/java/com/alibaba/json/bvt/LongFieldTest_3.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 LongFieldTest_3 extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[2048];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();

            

Reported by PMD.

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

Line: 34

              
    public static class Model {

        public long value;

    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '14'-'29').
Error

Line: 14

              public class LongFieldTest_3 extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[2048];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/LongFieldTest_3_private.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 LongFieldTest_3_private extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[8192];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();

            

Reported by PMD.

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

Line: 34

              
    private static class Model {

        public long value;

    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '14'-'29').
Error

Line: 14

              public class LongFieldTest_3_private extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[8192];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();
        }

            

Reported by PMD.

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

              
public class LongFieldTest_3_stream extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[8192];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();

            

Reported by PMD.

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

Line: 38

              
    public static class Model {

        public long value;

    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '16'-'33').
Error

Line: 16

              public class LongFieldTest_3_stream extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[8192];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();
        }

            

Reported by PMD.

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

              
public class LongFieldTest_4 extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[2048];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();

            

Reported by PMD.

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

Line: 37

                  @JSONType(serialzeFeatures = SerializerFeature.BeanToArray, parseFeatures = Feature.SupportArrayToBean)
    public static class Model {

        public long value;

    }
}

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '17'-'32').
Error

Line: 17

              public class LongFieldTest_4 extends TestCase {

    public void test_min() throws Exception {
        Random random = new Random();
        Model[] array = new Model[2048];
        for (int i = 0; i < array.length; ++i) {
            array[i] = new Model();
            array[i].value = random.nextLong();
        }

            

Reported by PMD.