The following issues were found

src/test/java/com/alibaba/json/bvt/date/DateTest_dotnet_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: 14

              
public class DateTest_dotnet_4 extends TestCase {

    public void test_date() throws Exception {
        String text = "{\"date\":\"/Date(1461081600321+5000)/\"}";

        JSONObject model = JSON.parseObject(text);
        Assert.assertEquals(1461081600321L, ((java.util.Date) model.getObject("date", java.util.Date.class)).getTime());
    }

            

Reported by PMD.

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

Line: 18

                      String text = "{\"date\":\"/Date(1461081600321+5000)/\"}";

        JSONObject model = JSON.parseObject(text);
        Assert.assertEquals(1461081600321L, ((java.util.Date) model.getObject("date", java.util.Date.class)).getTime());
    }

    private static class Model {

        private Date date;

            

Reported by PMD.

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

               * Created by wenshao on 01/06/2017.
 */
public class Issue1240 extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig parserConfig = new ParserConfig();
        parserConfig.setAutoTypeSupport(true);
        LinkedMultiValueMap<String, String> result = new LinkedMultiValueMap();
        result.add("test", "11111");
        String test = JSON.toJSONString(result, SerializerFeature.WriteClassName);

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 01/06/2017.
 */
public class Issue1240 extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig parserConfig = new ParserConfig();
        parserConfig.setAutoTypeSupport(true);
        LinkedMultiValueMap<String, String> result = new LinkedMultiValueMap();
        result.add("test", "11111");
        String test = JSON.toJSONString(result, SerializerFeature.WriteClassName);

            

Reported by PMD.

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

    public void test_parse() throws Exception {
        JSON.parseObject("{}", Hidden.class);
    }

    public static class Hidden {
        private Hidden() {}

            

Reported by PMD.

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

Line: 11

               */
public class PrivateConstrunctorTest extends TestCase {

    public void test_parse() throws Exception {
        JSON.parseObject("{}", Hidden.class);
    }

    public static class Hidden {
        private Hidden() {}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/date/DateFieldTest6.java
2 issues
JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 16

              import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;

public class DateFieldTest6 extends TestCase {
    protected void setUp() throws Exception {
        JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
        JSON.defaultLocale = Locale.CHINA;
    }
    
	public void test_0() throws Exception {

            

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

                      JSON.defaultLocale = Locale.CHINA;
    }
    
	public void test_0() throws Exception {
		SerializeConfig mapping = new SerializeConfig();
		mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));

		Entity object = new Entity();
		object.setValue(new Date());

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/comparing_json_modules/Invalid_Test.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 25/03/2017.
 */
public class Invalid_Test extends TestCase {
    public void test_6_1() throws Exception {
        assertEquals(0, JSON.parse("+0"));
    }

//    public void test_6_5() throws Exception {
//        assertEquals(28, JSON.parse("034"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 11

               */
public class Invalid_Test extends TestCase {
    public void test_6_1() throws Exception {
        assertEquals(0, JSON.parse("+0"));
    }

//    public void test_6_5() throws Exception {
//        assertEquals(28, JSON.parse("034"));
//    }

            

Reported by PMD.

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

    public void test_0() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setAsmEnable(false);
        
        String text = JSON.toJSONString(new Entity(), config);
        Assert.assertEquals("{\"value\":null}", text);

            

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

                      Assert.assertEquals("{\"value\":null}", text);
    }
    
    public void test_1() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setAsmEnable(true);
        
        String text = JSON.toJSONString(new Entity(), config);
        Assert.assertEquals("{\"value\":null}", text);

            

Reported by PMD.

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

Line: 8

              import junit.framework.TestCase;

public class Issue3109 extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig config = new ParserConfig();
        config.addAccept("test");
        JSON.parseObject("{\"@type\":\"testxx\",\"dogName\":\"dog1001\"}", Dog.class, config);
    }


            

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

              import junit.framework.TestCase;

public class Issue3109 extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig config = new ParserConfig();
        config.addAccept("test");
        JSON.parseObject("{\"@type\":\"testxx\",\"dogName\":\"dog1001\"}", Dog.class, config);
    }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/creator/JSONCreatorTest5.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 JSONCreatorTest5 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 JSONCreatorTest5 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/issue_3600/Issue3628.java
2 issues
JUnit tests should include assert() or fail()
Design

Line: 7

              import junit.framework.TestCase;

public class Issue3628 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"admin\":3483706632,\"admins\":[],\"black\":{\"blackList\":[]},\"enable\":true,\"messages\":{\"adminChangeDown\":\"[mirai:at:%target%] 被撤销了管理~\",\"adminChangeUp\":\"恭喜 [mirai:at:%target%] 被升为管理员~\",\"blacelist\":\"[mirai:at:%target%]你被加入此群黑名单,不允许你进入本群\",\"clearnScreen\":\"清屏ing~~~\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n清屏完毕~~~\",\"join\":\"欢迎 [mirai:at:%target%] 进入本群~\",\"kick\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 踢出本群\",\"leave\":\"很遗憾, [mirai:at:%target%] 离开了本群\",\"mute\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 禁言 %time%\",\"talkative\":\"恭喜 [mirai:at:%target%] 成为本群龙王!\",\"title\":\"恭喜 [mirai:at:%target%] 获得群主授予的 %title% 头衔!\",\"unmute\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 解除禁言\",\"warn\":\"\"},\"requestConfig\":{\"keyWordRegex\":\"SINGLE\",\"keyWords\":[\"栗子\"],\"type\":\"PASS\"},\"select\":{\"adminChange\":true,\"autoParseRequest\":true,\"join\":true,\"kick\":true,\"leave\":true,\"mute\":true,\"talkative\":true,\"title\":true,\"unmute\":true},\"warn\":{\"count\":10,\"countBlack\":30,\"warnList\":[{\"count\":-9999,\"id\":123456}]}}";
        JSON.parse(json);
    }
}

            

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 Issue3628 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"admin\":3483706632,\"admins\":[],\"black\":{\"blackList\":[]},\"enable\":true,\"messages\":{\"adminChangeDown\":\"[mirai:at:%target%] 被撤销了管理~\",\"adminChangeUp\":\"恭喜 [mirai:at:%target%] 被升为管理员~\",\"blacelist\":\"[mirai:at:%target%]你被加入此群黑名单,不允许你进入本群\",\"clearnScreen\":\"清屏ing~~~\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n清屏完毕~~~\",\"join\":\"欢迎 [mirai:at:%target%] 进入本群~\",\"kick\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 踢出本群\",\"leave\":\"很遗憾, [mirai:at:%target%] 离开了本群\",\"mute\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 禁言 %time%\",\"talkative\":\"恭喜 [mirai:at:%target%] 成为本群龙王!\",\"title\":\"恭喜 [mirai:at:%target%] 获得群主授予的 %title% 头衔!\",\"unmute\":\"[mirai:at:%target%] 被 [mirai:at:%operator%] 解除禁言\",\"warn\":\"\"},\"requestConfig\":{\"keyWordRegex\":\"SINGLE\",\"keyWords\":[\"栗子\"],\"type\":\"PASS\"},\"select\":{\"adminChange\":true,\"autoParseRequest\":true,\"join\":true,\"kick\":true,\"leave\":true,\"mute\":true,\"talkative\":true,\"title\":true,\"unmute\":true},\"warn\":{\"count\":10,\"countBlack\":30,\"warnList\":[{\"count\":-9999,\"id\":123456}]}}";
        JSON.parse(json);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/ReadOnlyCollectionTest.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 ReadOnlyCollectionTest extends TestCase {
    
    public void test_readOnlyNullList() throws Exception {
        String text = "{\"list\":[]}";
        Entity entity = JSON.parseObject(text, Entity.class);
        Assert.assertNotNull(entity);
    }


            

Reported by PMD.

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

Line: 21

              
    public static class Entity {

        private List<Object> list;

        public List<Object> getList() {
            return list;
        }


            

Reported by PMD.