The following issues were found

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

              import junit.framework.TestCase;

public class Bug_for_issue_349 extends TestCase {
    public void test_for_issue() throws Exception {
        Money money = new Money();
        money.currency = Currency.getInstance("CNY");
        money.amount = new BigDecimal("10.03");

        String json = JSON.toJSONString(money);

            

Reported by PMD.

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

Line: 32

                  }
    
    public static class Money {
        public Currency currency;
        public BigDecimal amount;

        @Override
        public String toString() {
            return "Money{currency=" + currency + ", amount=" + amount + '}';

            

Reported by PMD.

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

Line: 33

                  
    public static class Money {
        public Currency currency;
        public BigDecimal amount;

        @Override
        public String toString() {
            return "Money{currency=" + currency + ", amount=" + amount + '}';
        }

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        String json = "{value:[\"null\"]}";
        JSONObject parse = JSONObject.parseObject(json);
        JSONArray jsonArray = parse.getJSONArray("value");
        Assert.assertEquals(1, jsonArray.size());
    }

            

Reported by PMD.

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

Line: 15

                  public void test_for_issue() throws Exception {
        String json = "{value:[\"null\"]}";
        JSONObject parse = JSONObject.parseObject(json);
        JSONArray jsonArray = parse.getJSONArray("value");
        Assert.assertEquals(1, jsonArray.size());
    }

}

            

Reported by PMD.

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

Line: 16

                      String json = "{value:[\"null\"]}";
        JSONObject parse = JSONObject.parseObject(json);
        JSONArray jsonArray = parse.getJSONArray("value");
        Assert.assertEquals(1, jsonArray.size());
    }

}

            

Reported by PMD.

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

Line: 20

                      vo.setPanellot("150501");
        String text = JSON.toJSONString(vo);
        
        System.out.println(text);
        Assert.assertEquals("{\"Cl-\":\"150501\",\"Mg2+\":\"1435555992\",\"Na+\":\" 02570\",\"panellot\":\"150501\"}", text);
        
        ExaminationPojo v1 = JSON.parseObject(text, ExaminationPojo.class);
        Assert.assertEquals(vo.mg, v1.mg);
        Assert.assertEquals(vo.na, v1.na);

            

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 Bug_for_issue_449 extends TestCase {

    public void test_for_issue() throws Exception {
        ExaminationPojo vo = new ExaminationPojo();
        vo.setMg("1435555992");
        vo.setNa(" 02570");
        vo.setCl("150501");
        vo.setPanellot("150501");

            

Reported by PMD.

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

Line: 31

                      
    }

    public static class ExaminationPojo {

        @JSONField(name = "Mg2+")
        private String mg;
        @JSONField(name = "Na+")
        private String na;

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        VO vo = new VO();
        vo.sPhotoUrl = "xxx";
        
        String text = JSON.toJSONString(vo);
        VO vo2 = JSON.parseObject(text, VO.class);

            

Reported by PMD.

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

Line: 17

                      
        String text = JSON.toJSONString(vo);
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getsPhotoUrl(), vo2.getsPhotoUrl());
    }

    public static class VO {

        private String sPhotoUrl;

            

Reported by PMD.

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

Line: 22

              
    public static class VO {

        private String sPhotoUrl;

        public String getsPhotoUrl() {
            return sPhotoUrl;
        }


            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/issues3796/bean/ObjectG1.java
3 issues
Avoid unused private fields such as 'a'.
Design

Line: 9

              

public class ObjectG1 {
	private int a;
	private int b;
	private int c;
}

            

Reported by PMD.

Avoid unused private fields such as 'b'.
Design

Line: 10

              
public class ObjectG1 {
	private int a;
	private int b;
	private int c;
}

            

Reported by PMD.

Avoid unused private fields such as 'c'.
Design

Line: 11

              public class ObjectG1 {
	private int a;
	private int b;
	private int c;
}

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "wenshao";
        
        String text = JSON.toJSONString(model, SerializerFeature.WriteNonStringValueAsString);

            

Reported by PMD.

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

Line: 23

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

                  public static class Model {

        public int    id;
        public String name;

    }
}

            

Reported by PMD.

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

    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "wenshao";
        
        String text = JSON.toJSONString(model);

            

Reported by PMD.

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

Line: 23

                  public static class Model {

        @JSONField(serialzeFeatures = SerializerFeature.WriteNonStringValueAsString)
        public int    id;
        public String name;

    }
}

            

Reported by PMD.

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

Line: 24

              
        @JSONField(serialzeFeatures = SerializerFeature.WriteNonStringValueAsString)
        public int    id;
        public String name;

    }
}

            

Reported by PMD.

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

    public void test_null() throws Exception {
        VO vo = new VO();
        vo.setList(new ArrayList<String>());
        vo.getList().add(null);
        vo.getList().add(null);


            

Reported by PMD.

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

Line: 16

                  public void test_null() throws Exception {
        VO vo = new VO();
        vo.setList(new ArrayList<String>());
        vo.getList().add(null);
        vo.getList().add(null);

        Assert.assertEquals("{\"list\":[null,null]}", JSON.toJSONString(vo));
    }


            

Reported by PMD.

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

Line: 17

                      VO vo = new VO();
        vo.setList(new ArrayList<String>());
        vo.getList().add(null);
        vo.getList().add(null);

        Assert.assertEquals("{\"list\":[null,null]}", JSON.toJSONString(vo));
    }

    public static class VO {

            

Reported by PMD.

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

Line: 14

              
    public void test_0() throws Exception {

        System.out.println("{}");

        JSONObject.parseObject("{\"id\":{}}", new TypeReference<Map<String, Map<String,User>>>() {
        });
    }


            

Reported by PMD.

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

Line: 12

              
public class Bug_for_lenolix_3 extends TestCase {

    public void test_0() throws Exception {

        System.out.println("{}");

        JSONObject.parseObject("{\"id\":{}}", new TypeReference<Map<String, Map<String,User>>>() {
        });

            

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 Bug_for_lenolix_3 extends TestCase {

    public void test_0() throws Exception {

        System.out.println("{}");

        JSONObject.parseObject("{\"id\":{}}", new TypeReference<Map<String, Map<String,User>>>() {
        });

            

Reported by PMD.

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

Line: 17

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

    public abstract static class Model {

        public abstract Serializable getId();

            

Reported by PMD.

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

Line: 11

              
public class Bug_for_leupom extends TestCase {

    public void test_bug() throws Exception {
        Person person = new Person();
        person.setId(12345);
        
        String text = JSON.toJSONString(person);
        

            

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

              
public class Bug_for_leupom extends TestCase {

    public void test_bug() throws Exception {
        Person person = new Person();
        person.setId(12345);
        
        String text = JSON.toJSONString(person);
        

            

Reported by PMD.