The following issues were found

src/test/java/com/alibaba/json/bvt/guava/ImmutableMapTest.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 15/01/2017.
 */
public class ImmutableMapTest extends TestCase {
    public void test_immutableMap() throws Exception {
        Map<String, Integer> map = ImmutableMap.of("a", 1, "b", 2, "c", 3);
        String json = JSON.toJSONString(map);
        assertEquals("{\"a\":1,\"b\":2,\"c\":3}", json);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                  public void test_immutableMap() throws Exception {
        Map<String, Integer> map = ImmutableMap.of("a", 1, "b", 2, "c", 3);
        String json = JSON.toJSONString(map);
        assertEquals("{\"a\":1,\"b\":2,\"c\":3}", json);
    }
}

            

Reported by PMD.

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

Line: 15

               * @Date :Created in 16:27 2020/6/29
 */
public class Issue3309 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject jsonObj = new JSONObject();
        jsonObj.put("formatDate","20200623 15:20:01");
        DateFormatTest dateFormatTest = jsonObj.toJavaObject(DateFormatTest.class);
        JSON.toJSONString(dateFormatTest);
    }

            

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

               * @Date :Created in 16:27 2020/6/29
 */
public class Issue3309 extends TestCase {
    public void test_for_issue() throws Exception {
        JSONObject jsonObj = new JSONObject();
        jsonObj.put("formatDate","20200623 15:20:01");
        DateFormatTest dateFormatTest = jsonObj.toJavaObject(DateFormatTest.class);
        JSON.toJSONString(dateFormatTest);
    }

            

Reported by PMD.

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

               * Created by wenshao on 14/03/2017.
 */
public class LongAdderTest extends TestCase {
    public void test_long_add() throws Exception {
        LongAdder adder = new LongAdder();
        adder.add(3);

        String json = JSON.toJSONString(adder);
        assertEquals("{\"value\":3}", json);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      adder.add(3);

        String json = JSON.toJSONString(adder);
        assertEquals("{\"value\":3}", json);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1400/Issue1482.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.util.Date;

public class Issue1482 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"date\":\"2017-06-28T07:20:05.000+05:30\"}", Model.class);
    }

    public static class Model {
        public Date date;

            

Reported by PMD.

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

Line: 9

              import java.util.Date;

public class Issue1482 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("{\"date\":\"2017-06-28T07:20:05.000+05:30\"}", Model.class);
    }

    public static class Model {
        public Date date;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/mixins/MixinMergingTest.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: 30

              
    static class PersonMixin extends ContactMixin implements Person {}

    public void test() throws Exception {
        JSON.addMixInAnnotations(Person.class, PersonMixin.class);
        assertEquals("{\"city\":\"Seattle\"}", JSON.toJSONString(new PersonImpl()));
        JSON.removeMixInAnnotations(Person.class);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 32

              
    public void test() throws Exception {
        JSON.addMixInAnnotations(Person.class, PersonMixin.class);
        assertEquals("{\"city\":\"Seattle\"}", JSON.toJSONString(new PersonImpl()));
        JSON.removeMixInAnnotations(Person.class);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/DefaultExtJSONParserTest_5.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 DefaultExtJSONParserTest_5 extends TestCase {
    
    public void test_0() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("{,,,,\"value\":3,\"id\":1}");
        parser.config(Feature.AllowArbitraryCommas, true);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue());

            

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

                      Assert.assertEquals(3, entity.getValue());
    }
    
    public void test_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("{\"value\":3,\"id\":1}");
        parser.config(Feature.AllowArbitraryCommas, false);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue());

            

Reported by PMD.

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

              import junit.framework.TestCase;

public class OrderedFieldTest extends TestCase {
    public void test_ordered_field() throws Exception {
        String text = "{\"id\":1001}";
        Model model = JSON.parseObject(text, Model.class, Feature.OrderedField);
        Assert.assertEquals(1001, model.getId());
        String text2 = JSON.toJSONString(model);
        Assert.assertEquals(text, text2);

            

Reported by PMD.

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

Line: 14

                  public void test_ordered_field() throws Exception {
        String text = "{\"id\":1001}";
        Model model = JSON.parseObject(text, Model.class, Feature.OrderedField);
        Assert.assertEquals(1001, model.getId());
        String text2 = JSON.toJSONString(model);
        Assert.assertEquals(text, text2);
        
    }
    

            

Reported by PMD.

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

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

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertEquals(1461081600000L, model.date.getTime());
    }

            

Reported by PMD.

Potential violation of Law of Demeter (static property access)
Design

Line: 17

                      String text = "{\"date\":\"/Date(1461081600000)/\"}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertEquals(1461081600000L, model.date.getTime());
    }

    public static class Model {

        private Date date;

            

Reported by PMD.

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

              import com.alibaba.fastjson.parser.ParserConfig;

public class DefaultJSONParserTest_charArray extends TestCase {
    public void test_getInput() {
        String text = "{}";
        char[] chars = text.toCharArray();
        DefaultJSONParser parser = new DefaultJSONParser(chars, chars.length, ParserConfig.getGlobalInstance(), 0);
        
        Assert.assertEquals(text, parser.getInput());

            

Reported by PMD.

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

Line: 12

              public class DefaultJSONParserTest_charArray extends TestCase {
    public void test_getInput() {
        String text = "{}";
        char[] chars = text.toCharArray();
        DefaultJSONParser parser = new DefaultJSONParser(chars, chars.length, ParserConfig.getGlobalInstance(), 0);
        
        Assert.assertEquals(text, parser.getInput());
    }
}

            

Reported by PMD.

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

              
public class UTF8ByteArrayParseTest extends TestCase {

    public void test_utf8() throws Exception {
        byte[] bytes = "{'name':'xxx', age:3, birthday:\"2009-09-05\"}".getBytes("UTF-8");

        JSON.parseObject(bytes, JSONObject.class);
    }
}

            

Reported by PMD.

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

Line: 10

              
public class UTF8ByteArrayParseTest extends TestCase {

    public void test_utf8() throws Exception {
        byte[] bytes = "{'name':'xxx', age:3, birthday:\"2009-09-05\"}".getBytes("UTF-8");

        JSON.parseObject(bytes, JSONObject.class);
    }
}

            

Reported by PMD.