The following issues were found

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

    public void test_e() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{type:'AA'}"));
        VO vo2 = reader.readObject(VO.class);
        Assert.assertEquals(Type.AA, vo2.getType());
        reader.close();
    }

            

Reported by PMD.

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

Line: 16

                  public void test_e() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{type:'AA'}"));
        VO vo2 = reader.readObject(VO.class);
        Assert.assertEquals(Type.AA, vo2.getType());
        reader.close();
    }

    public static class VO {


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2000/Issue2086.java
2 issues
JUnit tests should include assert() or fail()
Design

Line: 7

              import junit.framework.TestCase;

public class Issue2086 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"id\":123}", Model.class);
        JSON.toJSONString(new Model());
    }

    public static class Model {

            

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

              import junit.framework.TestCase;

public class Issue2086 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"id\":123}", Model.class);
        JSON.toJSONString(new Model());
    }

    public static class Model {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2600/Issue2635.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 Issue2635 extends TestCase {
    public void testForIssue() throws Exception {
        String json = "{\"dt\":\"evt\",\"pr\":{\"_订单金额\":\"100\",\"$AA_epid#_优惠券金额\":848,\"$AA_eptp#_Client_id\":\"string\",\"$AA_eptp#_访客类别\":\"string\",\"$AA_uid\":856,\"$AA_eptp#_优惠券类型\":\"string\",\"$AA_sid\":1565851940554,\"$AA_eptp#_优惠券金额\":\"string\",\"$AA_epid#_订单金额\":855,\"$AA_epid#_订单号\":847,\"_优惠券名称\":\"60元优惠折扣券\",\"$eid\":\"小程序_订单确认\",\"$AA_eptp#_订单渠道\":\"string\",\"$ct\":1565854057608,\"$cuid\":\"YYYY\",\"_Experiment_id\":\"0\",\"$AA_epid#_优惠券类型\":853,\"_优惠券类型\":\"D4\",\"_店主ID\":\"53890475\",\"_优惠券金额\":\"100\",\"$AA_eptp#_Experiment_id\":\"string\",\"$AA_epid#_优惠券名称\":850,\"$AA_eptp#_优惠券名称\":\"string\",\"_优惠券 ID\":\"916090\",\"$AA_epid#_店主ID\":851,\"$tz\":28800000,\"$AA_eptp#_优惠券 ID\":\"string\",\"$AA_eptp#_订单号\":\"string\",\"$AA_AAid\":7097,\"$AA_eptp#_店主ID\":\"string\",\"$AA_eid\":175,\"$AA_epid#_Client_id\":21544,\"$sid\":1569851940554,\"_订单渠道\":\"云购小程序\",\"_Client_id\":\"1e8e82fe-c90f-f363-6693-143677891dfa\",\"$AA_epid#_事件类型\":3073,\"$AA_epid#_分享来源用户\":14694,\"$AA_epid#_Experiment_id\":21543,\"_分享来源用户\":\"53890475\",\"$AA_eptp#_订单金额\":\"string\",\"$AA_epid#_订单渠道\":852,\"$AA_eptp#_分享来源用户\":\"string\",\"$url\":\"http://171.90.15:87/CCTesting/data/toPrivateTest?test=https://u2.CCio.com/CC.js&appkey=b8868018cIO94114ad7a81cd5f1ddafd\",\"_访客类别\":\"ABO\",\"$AA_epid#_优惠券 ID\":854,\"_订单号\":\"PP190830000683\",\"_下单用户\":\"720003734\",\"$AA_epid#_下单用户\":849,\"$AA_eptp#_事件类型\":\"string\",\"$uuid\":\"5c910d893bc341aBHN02119708ec13df\",\"$AA_eptp#_下单用户\":\"string\",\"$AA_epid#_访客类别\":856,\"$AA_did\":6736,\"$referrer_domain\":\"10.33.180.15:8088\",\"_事件类型\":\"订单确认\",\"$ref\":\"http://10.283.100.10:8088/CCTesting/data/toPrivate\"}}\n";
        JSON.parseObject(json);
    }
}

            

Reported by PMD.

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

Line: 7

              import junit.framework.TestCase;

public class Issue2635 extends TestCase {
    public void testForIssue() throws Exception {
        String json = "{\"dt\":\"evt\",\"pr\":{\"_订单金额\":\"100\",\"$AA_epid#_优惠券金额\":848,\"$AA_eptp#_Client_id\":\"string\",\"$AA_eptp#_访客类别\":\"string\",\"$AA_uid\":856,\"$AA_eptp#_优惠券类型\":\"string\",\"$AA_sid\":1565851940554,\"$AA_eptp#_优惠券金额\":\"string\",\"$AA_epid#_订单金额\":855,\"$AA_epid#_订单号\":847,\"_优惠券名称\":\"60元优惠折扣券\",\"$eid\":\"小程序_订单确认\",\"$AA_eptp#_订单渠道\":\"string\",\"$ct\":1565854057608,\"$cuid\":\"YYYY\",\"_Experiment_id\":\"0\",\"$AA_epid#_优惠券类型\":853,\"_优惠券类型\":\"D4\",\"_店主ID\":\"53890475\",\"_优惠券金额\":\"100\",\"$AA_eptp#_Experiment_id\":\"string\",\"$AA_epid#_优惠券名称\":850,\"$AA_eptp#_优惠券名称\":\"string\",\"_优惠券 ID\":\"916090\",\"$AA_epid#_店主ID\":851,\"$tz\":28800000,\"$AA_eptp#_优惠券 ID\":\"string\",\"$AA_eptp#_订单号\":\"string\",\"$AA_AAid\":7097,\"$AA_eptp#_店主ID\":\"string\",\"$AA_eid\":175,\"$AA_epid#_Client_id\":21544,\"$sid\":1569851940554,\"_订单渠道\":\"云购小程序\",\"_Client_id\":\"1e8e82fe-c90f-f363-6693-143677891dfa\",\"$AA_epid#_事件类型\":3073,\"$AA_epid#_分享来源用户\":14694,\"$AA_epid#_Experiment_id\":21543,\"_分享来源用户\":\"53890475\",\"$AA_eptp#_订单金额\":\"string\",\"$AA_epid#_订单渠道\":852,\"$AA_eptp#_分享来源用户\":\"string\",\"$url\":\"http://171.90.15:87/CCTesting/data/toPrivateTest?test=https://u2.CCio.com/CC.js&appkey=b8868018cIO94114ad7a81cd5f1ddafd\",\"_访客类别\":\"ABO\",\"$AA_epid#_优惠券 ID\":854,\"_订单号\":\"PP190830000683\",\"_下单用户\":\"720003734\",\"$AA_epid#_下单用户\":849,\"$AA_eptp#_事件类型\":\"string\",\"$uuid\":\"5c910d893bc341aBHN02119708ec13df\",\"$AA_eptp#_下单用户\":\"string\",\"$AA_epid#_访客类别\":856,\"$AA_did\":6736,\"$referrer_domain\":\"10.33.180.15:8088\",\"_事件类型\":\"订单确认\",\"$ref\":\"http://10.283.100.10:8088/CCTesting/data/toPrivate\"}}\n";
        JSON.parseObject(json);
    }
}

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class Issue2787 extends TestCase {
    public void test_for_issue() throws Exception {
        Model m = new Model();
        String str = JSON.toJSONString(m, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty);
        assertEquals("{\"value\":[]}", str);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 11

                  public void test_for_issue() throws Exception {
        Model m = new Model();
        String str = JSON.toJSONString(m, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty);
        assertEquals("{\"value\":[]}", str);
    }

    public static class Model {
        public int[] value;
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2200/Issue2206.java
2 issues
JUnit tests should include assert() or fail()
Design

Line: 9

              import java.time.LocalDateTime;

public class Issue2206 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"date\":\"20181229162849\"}", Model.class);
    }

    public static class Model {
        public LocalDateTime date;

            

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

              import java.time.LocalDateTime;

public class Issue2206 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"date\":\"20181229162849\"}", Model.class);
    }

    public static class Model {
        public LocalDateTime date;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONReaderScannerTest_int.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: 15

              
public class JSONReaderScannerTest_int extends TestCase {

    public void test_scanInt() throws Exception {
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < 1024; ++i) {
            if (i != 0) {
                buf.append(',');

            

Reported by PMD.

Ensure that resources like this StringReader object are closed after use
Error

Line: 26

                      }
        buf.append(']');

        Reader reader = new StringReader(buf.toString());

        JSONReaderScanner scanner = new JSONReaderScanner(reader);

        DefaultJSONParser parser = new DefaultJSONParser(scanner);
        JSONArray array = (JSONArray) parser.parse();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONReaderScannerTest_long.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: 15

              
public class JSONReaderScannerTest_long extends TestCase {

    public void test_scanInt() throws Exception {
        StringBuffer buf = new StringBuffer();
        buf.append('[');
        for (int i = 0; i < 1024; ++i) {
            if (i != 0) {
                buf.append(',');

            

Reported by PMD.

Ensure that resources like this StringReader object are closed after use
Error

Line: 27

                      }
        buf.append(']');

        Reader reader = new StringReader(buf.toString());

        JSONReaderScanner scanner = new JSONReaderScanner(reader);

        DefaultJSONParser parser = new DefaultJSONParser(scanner);
        JSONArray array = (JSONArray) parser.parse();

            

Reported by PMD.

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

    public void test_feature() throws Exception {
        Model model = new Model();
        model.id = 1001;
        String text = JSON.toJSONString(model, SerializerFeature.IgnoreErrorGetter);
        Assert.assertEquals("{\"id\":1001}", text);
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public int id;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/compatible/ThreadLocalCacheTest.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: 10

               * Created by wenshao on 29/01/2017.
 */
public class ThreadLocalCacheTest extends TestCase{
    public void test_threadCache() throws Exception {
        ThreadLocalCache.getBytes(10);
        ThreadLocalCache.clearBytes();
    }
}

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 29/01/2017.
 */
public class ThreadLocalCacheTest extends TestCase{
    public void test_threadCache() throws Exception {
        ThreadLocalCache.getBytes(10);
        ThreadLocalCache.clearBytes();
    }
}

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class Issue2306 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject object = new JSONObject();
        object.put("help_score_avg.cbm", 123);

        assertEquals(123
            , JSONPath.extract(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                      JSONObject object = new JSONObject();
        object.put("help_score_avg.cbm", 123);

        assertEquals(123
            , JSONPath.extract(
                    object.toJSONString(), "['help_score_avg.cbm']"));
    }
}

            

Reported by PMD.