The following issues were found

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

    public void test_0() throws Exception {
        String text = "{\"value\":1.0}";
        VO obj = JSON.parseObject(text, VO.class);
        Assert.assertEquals(1, obj.getValue());
    }


            

Reported by PMD.

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

Line: 14

                  public void test_0() throws Exception {
        String text = "{\"value\":1.0}";
        VO obj = JSON.parseObject(text, VO.class);
        Assert.assertEquals(1, obj.getValue());
    }

    /**
    public void test_1() throws Exception {
        JSONException error = null;

            

Reported by PMD.

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

Line: 7

              import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;

public class JSONScannerTest_scanFieldLong extends TestCase {

    public void test_0() throws Exception {
        String text = "{\"value\":1.0}";

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1800/Issue1856.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: 9

              import junit.framework.TestCase;

public class Issue1856 extends TestCase {
    public void test_excludes() throws Exception {
        VO vo = new VO();
        vo.setId(123);
        vo.setName("wenshao");
        vo.setPassword("ooxxx");
        vo.setInfo("fofo");

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      vo.setInfo("fofo");

        String text = JSON.toJSONString(vo, Labels.excludes("AuditIdEntity"));
        assertEquals("{\"id\":123,\"info\":\"fofo\",\"name\":\"wenshao\"}", text);
    }

    public static class VO {

        private int    id;

            

Reported by PMD.

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

Line: 20

                      assertEquals("{\"id\":123,\"info\":\"fofo\",\"name\":\"wenshao\"}", text);
    }

    public static class VO {

        private int    id;
        private String name;
        private String password;
        private String info;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/fullSer/is_set_test_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: 12

              
public class is_set_test_2 extends TestCase {

    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.set_flag(true);

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"flag\":true}", text);

            

Reported by PMD.

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

Line: 19

                      String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"flag\":true}", text);
        VO vo1 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(true, vo1.is_flag());
    }

    public static class VO {

        private boolean flag;

            

Reported by PMD.

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

Line: 24

              
    public static class VO {

        private boolean flag;

        public boolean is_flag() {
            return flag;
        }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/fullSer/getfTest_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: 12

              
public class getfTest_2 extends TestCase {

    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.setfFlag(true);

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"fFlag\":true}", text);

            

Reported by PMD.

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

Line: 19

                      String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"fFlag\":true}", text);
        VO vo1 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(true, vo1.isfFlag());
    }

    public static class VO {

        private boolean fFlag;

            

Reported by PMD.

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

Line: 24

              
    public static class VO {

        private boolean fFlag;

        public boolean isfFlag() {
            return fFlag;
        }


            

Reported by PMD.

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

    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.setfId(123);
        
        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"fId\":123}", text);

            

Reported by PMD.

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

Line: 19

                      String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"fId\":123}", text);
        VO vo1 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(123, vo1.getfId());
    }

    public static class VO {

        private int fId;

            

Reported by PMD.

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

Line: 24

              
    public static class VO {

        private int fId;

        
        public int getfId() {
            return fId;
        }

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class Issue3282 extends TestCase {
    public void test_for_issue() {
        Demo demo = JSON.parseObject("{'date':'2020-01-01 00:00:00 000'}", Demo.class);
        assertNotNull(demo.date);
    }

    public static class Demo {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 9

              public class Issue3282 extends TestCase {
    public void test_for_issue() {
        Demo demo = JSON.parseObject("{'date':'2020-01-01 00:00:00 000'}", Demo.class);
        assertNotNull(demo.date);
    }

    public static class Demo {
        public java.util.Date date;
    }

            

Reported by PMD.

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

Line: 13

                  }

    public static class Demo {
        public java.util.Date date;
    }
}
            

Reported by PMD.

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

    public void test_codec() throws Exception {
        VO vo = new VO();
        vo.set_id(123);

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"id\":123}", text);

            

Reported by PMD.

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

Line: 18

                      String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"id\":123}", text);
        VO vo1 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(123, vo1.get_id());
    }

    public static class VO {

        private int id;

            

Reported by PMD.

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

Line: 23

              
    public static class VO {

        private int id;

        public int get_id() {
            return id;
        }


            

Reported by PMD.

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

Line: 13

                      User user = new User();
        user.setId(9);
        user.setName("asdffsf");
        System.out.println(JSONObject.toJSONString(user));
    }

}

            

Reported by PMD.

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

Line: 9

              
public class Issue3132 extends TestCase {

    public void test_for_issue() throws Exception {
        User user = new User();
        user.setId(9);
        user.setName("asdffsf");
        System.out.println(JSONObject.toJSONString(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: 9

              
public class Issue3132 extends TestCase {

    public void test_for_issue() throws Exception {
        User user = new User();
        user.setId(9);
        user.setName("asdffsf");
        System.out.println(JSONObject.toJSONString(user));
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_3000/Issue3049.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: 8

              import junit.framework.TestCase;

public class Issue3049 extends TestCase {
    public void test_for_issue() throws Exception {
        String json1 = "{\"date\":\"2019-11-1 21:45:12\"}";
        MyObject myObject1 = JSON.parseObject(json1, MyObject.class);
        String str2 = JSON.toJSONStringWithDateFormat(myObject1, "yyyy-MM-dd HH:mm:ss");
        assertEquals("{\"date\":\"2019-11-01 21:45:12\"}", str2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                      String json1 = "{\"date\":\"2019-11-1 21:45:12\"}";
        MyObject myObject1 = JSON.parseObject(json1, MyObject.class);
        String str2 = JSON.toJSONStringWithDateFormat(myObject1, "yyyy-MM-dd HH:mm:ss");
        assertEquals("{\"date\":\"2019-11-01 21:45:12\"}", str2);
    }

    public static class MyObject {
        public java.util.Date date;
    }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.serializer.SerializerFeature'
Design

Line: 4

              package com.alibaba.json.bvt.issue_3000;

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

public class Issue3049 extends TestCase {
    public void test_for_issue() throws Exception {
        String json1 = "{\"date\":\"2019-11-1 21:45:12\"}";

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/ReadOnlyCollectionTest_final_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: 13

              
public class ReadOnlyCollectionTest_final_field extends TestCase {
    
    public void test_readOnlyNullList() throws Exception {
        String text = "{\"list\":[1,2,3]}";
        Entity entity = JSON.parseObject(text, Entity.class);
        Assert.assertNull(entity.list);
    }


            

Reported by PMD.

This final field could be made static
Design

Line: 21

              
    public static class Entity {

        public final List<Object> list = null;

    }
}

            

Reported by PMD.

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

Line: 21

              
    public static class Entity {

        public final List<Object> list = null;

    }
}

            

Reported by PMD.