The following issues were found

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

    public void test_create_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"id\":1001,\"name\":\"wenshao\",\"obj\":{\"$ref\":\"$\"}}", Entity.class);
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '15'-'19').
Error

Line: 15

              public class JSONCreatorTest6 extends TestCase {

    public void test_create_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"id\":1001,\"name\":\"wenshao\",\"obj\":{\"$ref\":\"$\"}}", Entity.class);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

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

    public void test_0() throws Exception {
        Assert.assertNull(JSON.parseObject("", java.sql.Date.class));
        Assert.assertNull(JSON.parseObject(null, java.sql.Date.class));
        Assert.assertNull(JSON.parseObject("null", java.sql.Date.class));
        Assert.assertNull(JSON.parseObject("\"\"", java.sql.Date.class));


            

Reported by PMD.

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

Line: 28

                      Assert.assertNull(JSON.parseObject("null", java.sql.Timestamp.class));
        Assert.assertNull(JSON.parseObject("\"\"", java.sql.Timestamp.class));
        
        Assert.assertNull(JSON.parseObject("{date:\"\"}", Entity.class).getDate());
    }

    public static class Entity {

        private Date date;

            

Reported by PMD.

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

    public void test_optional() throws Exception {
        Model model = new Model();
        model.value = Optional.empty();

        String text = JSON.toJSONString(model);


            

Reported by PMD.

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

Line: 28

              

    public static class Model {
        public Optional<Value> value;
    }
    
    public static class Value {
        
    }

            

Reported by PMD.

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

              
public class JSONLexerTest_3 extends TestCase {

    public void test_matchField() throws Exception {
        JSON.parseObject("{\"val\":{}}", VO.class);
    }

    public static class VO {


            

Reported by PMD.

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

Line: 9

              
public class JSONLexerTest_3 extends TestCase {

    public void test_matchField() throws Exception {
        JSON.parseObject("{\"val\":{}}", VO.class);
    }

    public static class VO {


            

Reported by PMD.

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

    public void test_scanFieldString() throws Exception {
        VO vo = JSON.parseObject("{\"value\":\"abc\"}", VO.class);
        Assert.assertEquals("abc", vo.getValue());
    }

    public static class VO {

            

Reported by PMD.

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

Line: 13

              
    public void test_scanFieldString() throws Exception {
        VO vo = JSON.parseObject("{\"value\":\"abc\"}", VO.class);
        Assert.assertEquals("abc", vo.getValue());
    }

    public static class VO {

        private String value;

            

Reported by PMD.

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

    public void test_readOnlyNullList() throws Exception {
        String text = "{\"values\":{\"a\":{}}}";
        Entity entity = JSON.parseObject(text, Entity.class);
        Assert.assertNotNull(entity);
        Assert.assertNotNull(entity.values);
    }

            

Reported by PMD.

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

Line: 22

              
    public static class Entity {

        private Map<String, A> values;

        public Map<String, A> getValues() {
            return values;
        }


            

Reported by PMD.

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

public class Issue1450 extends TestCase {
    public void test_for_issue() throws Exception {
        LocalDateTime localDateTime = LocalDateTime.of(2018, 8, 31, 15, 26, 37, 1);
        String json = JSON.toJSONStringWithDateFormat(localDateTime, "yyyy-MM-dd HH:mm:ss");//2018-08-31T15:26:37.000000001
        assertEquals("\"2018-08-31 15:26:37\"", json);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                  public void test_for_issue() throws Exception {
        LocalDateTime localDateTime = LocalDateTime.of(2018, 8, 31, 15, 26, 37, 1);
        String json = JSON.toJSONStringWithDateFormat(localDateTime, "yyyy-MM-dd HH:mm:ss");//2018-08-31T15:26:37.000000001
        assertEquals("\"2018-08-31 15:26:37\"", json);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2300/Issue2344.java
2 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 Issue2344 extends TestCase {
    public void test_for_issue() throws Exception {
        LongPrimitiveEntity vo = new LongPrimitiveEntity(9007199254741992L);

        assertEquals("{\"value\":\"9007199254741992\"}"
                , JSON.toJSONString(vo, SerializerFeature.BrowserCompatible));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                  public void test_for_issue() throws Exception {
        LongPrimitiveEntity vo = new LongPrimitiveEntity(9007199254741992L);

        assertEquals("{\"value\":\"9007199254741992\"}"
                , JSON.toJSONString(vo, SerializerFeature.BrowserCompatible));
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2400/Issue2429.java
2 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 Issue2429 extends TestCase {
    public void testForIssue() {
        String str = "{\"schema\":{$ref:\"111\"},\"name\":\"ft\",\"age\":12,\"address\":\"杭州\"}";
        JSON.parseObject(str);
    }
}

            

Reported by PMD.

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

Line: 7

              import junit.framework.TestCase;

public class Issue2429 extends TestCase {
    public void testForIssue() {
        String str = "{\"schema\":{$ref:\"111\"},\"name\":\"ft\",\"age\":12,\"address\":\"杭州\"}";
        JSON.parseObject(str);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/fullSer/LongTest.java
2 issues
System.out.println is used
Design

Line: 17

                      vo.setValue(33L);
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
        System.out.println(text);
        
        Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.fullSer.LongTest$VO\",\"value\":33}", text);
    }

    public static class VO {

            

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

    public void test_0() throws Exception {
        
        VO vo = new VO();
        vo.setValue(33L);
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);

            

Reported by PMD.