The following issues were found

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

Line: 18

                      vo.setDate(OffsetDateTime.now());
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        
        VO vo1 = JSON.parseObject(text, VO.class);
        
        Assert.assertEquals(vo.getDate(), vo1.getDate());
    }

            

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

    public void test_for_issue() throws Exception {
        VO vo = new VO();
        vo.setDate(OffsetDateTime.now());
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);

            

Reported by PMD.

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

Line: 22

                      
        VO vo1 = JSON.parseObject(text, VO.class);
        
        Assert.assertEquals(vo.getDate(), vo1.getDate());
    }

    public static class VO {

        private OffsetDateTime date;

            

Reported by PMD.

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

Line: 18

                      vo.setDate(OffsetTime.now());
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        
        VO vo1 = JSON.parseObject(text, VO.class);
        
        Assert.assertEquals(vo.getDate(), vo1.getDate());
    }

            

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

    public void test_for_issue() throws Exception {
        VO vo = new VO();
        vo.setDate(OffsetTime.now());
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);

            

Reported by PMD.

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

Line: 22

                      
        VO vo1 = JSON.parseObject(text, VO.class);
        
        Assert.assertEquals(vo.getDate(), vo1.getDate());
    }

    public static class VO {

        private OffsetTime date;

            

Reported by PMD.

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

Line: 15

                  public void test_for_issue() throws Exception {
        ExtendedServletRequestDataBinder binder = new ExtendedServletRequestDataBinder(new Object());
        String json = JSON.toJSONString(binder);
        System.out.println(json);
        Assert.assertTrue(json.indexOf("$ref")>=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: 12

               * Created by kimmking on 03/08/2017.
 */
public class Issue1368 extends TestCase {
    public void test_for_issue() throws Exception {
        ExtendedServletRequestDataBinder binder = new ExtendedServletRequestDataBinder(new Object());
        String json = JSON.toJSONString(binder);
        System.out.println(json);
        Assert.assertTrue(json.indexOf("$ref")>=0);
    }

            

Reported by PMD.

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

Line: 16

                      ExtendedServletRequestDataBinder binder = new ExtendedServletRequestDataBinder(new Object());
        String json = JSON.toJSONString(binder);
        System.out.println(json);
        Assert.assertTrue(json.indexOf("$ref")>=0);
    }
}

            

Reported by PMD.

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

    public void test_ordered_field() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"id\":1001}", Model.class);
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 15

                      Exception error = null;
        try {
            JSON.parseObject("{\"id\":1001}", Model.class);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }


            

Reported by PMD.

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

Line: 12

              public class CreateInstanceErrorTest extends TestCase {

    public void test_ordered_field() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"id\":1001}", Model.class);
        } catch (Exception ex) {
            error = ex;
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue1644.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 java.sql.Time;

public class Issue1644 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("time", 1324138987429L);

        Time time = jsonObject.getObject("time", java.sql.Time.class);
        assertEquals(1324138987429L, time.getTime());

            

Reported by PMD.

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

Line: 14

                      jsonObject.put("time", 1324138987429L);

        Time time = jsonObject.getObject("time", java.sql.Time.class);
        assertEquals(1324138987429L, time.getTime());
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      jsonObject.put("time", 1324138987429L);

        Time time = jsonObject.getObject("time", java.sql.Time.class);
        assertEquals(1324138987429L, time.getTime());
    }
}

            

Reported by PMD.

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

    public void test_create() throws Exception {
        Model model = JSON.parseObject("{\"name\":\"wenshao\"}", Model.class);
        Assert.assertEquals(0, model.id);
        Assert.assertEquals("wenshao", model.name);
    }


            

Reported by PMD.

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

Line: 20

              
    public static class Model {

        private final long id;
        private final String name;

        @JSONCreator
        public Model(@JSONField(name="id") long id, @JSONField(name="name") String name) {
            this.id = id;

            

Reported by PMD.

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

Line: 21

                  public static class Model {

        private final long id;
        private final String name;

        @JSONCreator
        public Model(@JSONField(name="id") long id, @JSONField(name="name") String name) {
            this.id = id;
            this.name = name;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue1645.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 java.time.LocalDateTime;

public class Issue1645 extends TestCase {
    public void test_for_issue() throws Exception {
        String test = "{\"name\":\"test\",\"testDateTime\":\"2017-12-08 14:55:16\"}";
        JSON.toJSONString(JSON.parseObject(test).toJavaObject(TestDateClass.class), SerializerFeature.PrettyFormat);
    }

    public static class TestDateClass{

            

Reported by PMD.

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

Line: 10

              import java.time.LocalDateTime;

public class Issue1645 extends TestCase {
    public void test_for_issue() throws Exception {
        String test = "{\"name\":\"test\",\"testDateTime\":\"2017-12-08 14:55:16\"}";
        JSON.toJSONString(JSON.parseObject(test).toJavaObject(TestDateClass.class), SerializerFeature.PrettyFormat);
    }

    public static class TestDateClass{

            

Reported by PMD.

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

Line: 12

              public class Issue1645 extends TestCase {
    public void test_for_issue() throws Exception {
        String test = "{\"name\":\"test\",\"testDateTime\":\"2017-12-08 14:55:16\"}";
        JSON.toJSONString(JSON.parseObject(test).toJavaObject(TestDateClass.class), SerializerFeature.PrettyFormat);
    }

    public static class TestDateClass{
        public String name;
        public LocalDateTime testDateTime;

            

Reported by PMD.

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

               * Created by wenshao on 23/07/2017.
 */
public class Issue1320 extends TestCase {
    public void test_for_issue() throws Exception {
        SSOToken token = new SSOToken();
        JSON.toJSONString(token);
    }

    @SuppressWarnings("serial")

            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 23/07/2017.
 */
public class Issue1320 extends TestCase {
    public void test_for_issue() throws Exception {
        SSOToken token = new SSOToken();
        JSON.toJSONString(token);
    }

    @SuppressWarnings("serial")

            

Reported by PMD.

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

Line: 17

                  }

    @SuppressWarnings("serial")
    public static class SSOToken extends Token {

        /* 登录类型 */
        private Integer type;

        /* 预留 */

            

Reported by PMD.

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

Line: 18

                      .setWithFields(true);

        String json = JSON.toJSONString(params);
        System.out.println(json);
        params = JSON.parseObject(json, Params.class);
        assertEquals("{\"verification_ids\":[\"a\",\"b\"],\"with_fields\":true}", JSON.toJSONString(params));
    }

    @JSONType(naming = PropertyNamingStrategy.SnakeCase)

            

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

              import java.util.List;

public class Issue1647 extends TestCase {
    public void test_for_issue() throws Exception {
        Params params = new Params()
        .setVerificationIds(Arrays.asList(new String[]{"a", "b"}))
        .setWithFields(true);

        String json = JSON.toJSONString(params);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      String json = JSON.toJSONString(params);
        System.out.println(json);
        params = JSON.parseObject(json, Params.class);
        assertEquals("{\"verification_ids\":[\"a\",\"b\"],\"with_fields\":true}", JSON.toJSONString(params));
    }

    @JSONType(naming = PropertyNamingStrategy.SnakeCase)
    public static class Params {


            

Reported by PMD.

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

Line: 21

               * Created by kimmking on 02/07/2017.
 */
public class Issue1307 extends TestCase {
    ContextValueFilter contextValueFilter = new ContextValueFilter() {
     public Object process(BeanContext beanContext, Object obj, String name, Object value) {
            return "mark-"+value;
        }
    };
    ValueFilter valueFilter = new ValueFilter() {

            

Reported by PMD.

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

Line: 26

                          return "mark-"+value;
        }
    };
    ValueFilter valueFilter = new ValueFilter() {
        public Object process(Object object, String name, Object value) {
            return value;
        }
    };


            

Reported by PMD.

Avoid unused imports such as 'org.junit'
Design

Line: 10

              import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.ValueFilter;
import junit.framework.TestCase;
import org.junit.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

            

Reported by PMD.