The following issues were found

src/test/java/com/alibaba/json/bvt/kotlin/Issue1750.java
4 issues
System.out.println is used
Design

Line: 23

                              "}";
        Object obj = JSON.parseObject(json, clazz);
        String result = JSON.toJSONString(obj);
        System.out.println(result);
        assertEquals("{\"masterId\":\"1111111111111\",\"processId\":\"222222222222222\",\"taskId\":\"33333333333333\",\"taskName\":\"44444444444444\"}", result);
    }

    private static class ExtClassLoader extends ClassLoader {


            

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

              import java.io.InputStream;

public class Issue1750 extends TestCase {
    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("Issue1750_ProcessBO");

        String json = "{\n" +
                "\t\"masterId\": \"1111111111111\",\n" +

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                      Object obj = JSON.parseObject(json, clazz);
        String result = JSON.toJSONString(obj);
        System.out.println(result);
        assertEquals("{\"masterId\":\"1111111111111\",\"processId\":\"222222222222222\",\"taskId\":\"33333333333333\",\"taskName\":\"44444444444444\"}", result);
    }

    private static class ExtClassLoader extends ClassLoader {

        public ExtClassLoader() throws IOException {

            

Reported by PMD.

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

Line: 34

              
            {
                byte[] bytes;
                InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("kotlin/Issue1750_ProcessBO.clazz");
                bytes = IOUtils.toByteArray(is);
                is.close();

                super.defineClass("Issue1750_ProcessBO", bytes, 0, bytes.length);
            }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1400/Issue1487.java
4 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 Issue1487 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model._id = 1001L;
        model.id = 1002L;

        String json = JSON.toJSONString(model);

            

Reported by PMD.

Unit tests should not contain more than 1 assert(s).
Design

Line: 8

              import junit.framework.TestCase;

public class Issue1487 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model._id = 1001L;
        model.id = 1002L;

        String json = JSON.toJSONString(model);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      model.id = 1002L;

        String json = JSON.toJSONString(model);
        assertEquals("{\"_id\":1001,\"id\":1002}", json);
        Model model1 = JSON.parseObject(json, Model.class);
        assertEquals(json, JSON.toJSONString(model1));
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      String json = JSON.toJSONString(model);
        assertEquals("{\"_id\":1001,\"id\":1002}", json);
        Model model1 = JSON.parseObject(json, Model.class);
        assertEquals(json, JSON.toJSONString(model1));
    }

    public static class Model {
        private Long _id;
        private Long id;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1400/Issue1478.java
4 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 Issue1478 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.md5 = "xxx";

        String json = JSON.toJSONString(model);
        assertEquals("{\"MD5\":\"xxx\"}", json);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                      model.md5 = "xxx";

        String json = JSON.toJSONString(model);
        assertEquals("{\"MD5\":\"xxx\"}", json);
    }

    public static class Model {
        @JSONField(name = "MD5")
        private String md5;

            

Reported by PMD.

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

Line: 18

              
    public static class Model {
        @JSONField(name = "MD5")
        private String md5;

        public String getMD5() throws Exception {
            return md5;
        }
    }

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 20

                      @JSONField(name = "MD5")
        private String md5;

        public String getMD5() throws Exception {
            return md5;
        }
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/naming/ListCaseTest.java
4 issues
System.out.println is used
Design

Line: 16

                  public void test_0() throws Exception {
        String result = "{\"code\":\"SUCCESS\",\"msg\":\"success\",\"SUCCESS\":true,\"obj\":[\"10.55.251.213\"]}";
        T4QueryResult t4TaskApiResult = JSON.parseObject(result, T4QueryResult.class);
        System.out.println(JSON.toJSONString(t4TaskApiResult));

    }

    public static class Model {
        public List<String> values;

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 09/02/2017.
 */
public class ListCaseTest extends TestCase {
    public void test_0() throws Exception {
        String result = "{\"code\":\"SUCCESS\",\"msg\":\"success\",\"SUCCESS\":true,\"obj\":[\"10.55.251.213\"]}";
        T4QueryResult t4TaskApiResult = JSON.parseObject(result, T4QueryResult.class);
        System.out.println(JSON.toJSONString(t4TaskApiResult));

    }

            

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

               * Created by wenshao on 09/02/2017.
 */
public class ListCaseTest extends TestCase {
    public void test_0() throws Exception {
        String result = "{\"code\":\"SUCCESS\",\"msg\":\"success\",\"SUCCESS\":true,\"obj\":[\"10.55.251.213\"]}";
        T4QueryResult t4TaskApiResult = JSON.parseObject(result, T4QueryResult.class);
        System.out.println(JSON.toJSONString(t4TaskApiResult));

    }

            

Reported by PMD.

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

Line: 24

                      public List<String> values;
    }

    public static class T4QueryResult {

        @JSONField(name = "OBJ")
        private List<String> obj;

        @JSONField(name = "MSG")

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/AmbiguousTest.java
4 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 16/8/31.
 */
public class AmbiguousTest extends TestCase {
    public void test_for_issue() throws Exception {
        String text = "{\"items\":{\"id\":101}}";
        Model model = JSON.parseObject(text, Model.class);
        assertEquals(1, model.items.size());
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                  public void test_for_issue() throws Exception {
        String text = "{\"items\":{\"id\":101}}";
        Model model = JSON.parseObject(text, Model.class);
        assertEquals(1, model.items.size());
    }

    public static class Model {
        public List<Item> items;
    }

            

Reported by PMD.

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

Line: 15

                  public void test_for_issue() throws Exception {
        String text = "{\"items\":{\"id\":101}}";
        Model model = JSON.parseObject(text, Model.class);
        assertEquals(1, model.items.size());
    }

    public static class Model {
        public List<Item> items;
    }

            

Reported by PMD.

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

Line: 19

                  }

    public static class Model {
        public List<Item> items;
    }

    public static class Item {
        public int id;
    }

            

Reported by PMD.

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

    public void test_asm() throws Exception {
        A a = JSON.parseObject("{\"f1\":123}", A.class);
        Assert.assertEquals(123, a.getF1());
        Assert.assertNotNull(a.getF2());
    }


            

Reported by PMD.

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

Line: 15

              
    public void test_asm() throws Exception {
        A a = JSON.parseObject("{\"f1\":123}", A.class);
        Assert.assertEquals(123, a.getF1());
        Assert.assertNotNull(a.getF2());
    }

    public static class A {


            

Reported by PMD.

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

Line: 16

                  public void test_asm() throws Exception {
        A a = JSON.parseObject("{\"f1\":123}", A.class);
        Assert.assertEquals(123, a.getF1());
        Assert.assertNotNull(a.getF2());
    }

    public static class A {

        private int f1;

            

Reported by PMD.

The class 'A' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=4, WMC=4)
Design

Line: 19

                      Assert.assertNotNull(a.getF2());
    }

    public static class A {

        private int f1;

        private List<B>   f2 = new ArrayList<B>();


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1400/Issue1443.java
4 issues
JUnit tests should include assert() or fail()
Design

Line: 9

              import java.util.Date;

public class Issue1443 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"date\":\"3017-08-28T00:00:00+08:00\"}";
        Model model = JSON.parseObject(json, Model.class);

    }


            

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.util.Date;

public class Issue1443 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"date\":\"3017-08-28T00:00:00+08:00\"}";
        Model model = JSON.parseObject(json, Model.class);

    }


            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 11

              public class Issue1443 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"date\":\"3017-08-28T00:00:00+08:00\"}";
        Model model = JSON.parseObject(json, Model.class);

    }

    public static class Model {
        public Date date;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'model' (lines '11'-'13').
Error

Line: 11

              public class Issue1443 extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"date\":\"3017-08-28T00:00:00+08:00\"}";
        Model model = JSON.parseObject(json, Model.class);

    }

    public static class Model {
        public Date date;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1400/Issue1425.java
4 issues
System.out.println is used
Design

Line: 19

                              SerializerFeature.DisableCircularReferenceDetect
        };

        System.out.println(JSON.toJSONString(dicDomain, features));
    }
    public static class DicDomain {

        private String code;


            

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 Issue1425 extends TestCase {
    public void test_for_issue() throws Exception {
        DicDomain dicDomain = new DicDomain();
        dicDomain.setCode("A001");
        dicDomain.setName("测试");

        SerializerFeature[] features = new SerializerFeature[]{

            

Reported by PMD.

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

Line: 8

              import junit.framework.TestCase;

public class Issue1425 extends TestCase {
    public void test_for_issue() throws Exception {
        DicDomain dicDomain = new DicDomain();
        dicDomain.setCode("A001");
        dicDomain.setName("测试");

        SerializerFeature[] features = new SerializerFeature[]{

            

Reported by PMD.

The class 'DicDomain' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=4, WMC=4)
Design

Line: 21

              
        System.out.println(JSON.toJSONString(dicDomain, features));
    }
    public static class DicDomain {

        private String code;

        private String name;


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/AutoTypeCheckHandlerTest.java
4 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 AutoTypeCheckHandlerTest extends TestCase {
    public void test_for_issue() throws Exception {
        ParserConfig config = new ParserConfig();

        String str = "{\"@type\":\"com.alibaba.json.bvt.parser.autoType.AutoTypeCheckHandlerTest$Model\"}";
        JSONException error = null;
        try {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      } catch (JSONException ex) {
            error = ex;
        }
        assertNotNull(error);

        config.addAutoTypeCheckHandler(new ParserConfig.AutoTypeCheckHandler() {
            @Override
            public Class<?> handler(String typeName, Class<?> expectClass, int features) {
                if ("com.alibaba.json.bvt.parser.autoType.AutoTypeCheckHandlerTest$Model".equals(typeName)) {

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '13'-'17').
Error

Line: 13

                      ParserConfig config = new ParserConfig();

        String str = "{\"@type\":\"com.alibaba.json.bvt.parser.autoType.AutoTypeCheckHandlerTest$Model\"}";
        JSONException error = null;
        try {
            JSON.parse(str, config);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '13'-'17').
Error

Line: 13

                      ParserConfig config = new ParserConfig();

        String str = "{\"@type\":\"com.alibaba.json.bvt.parser.autoType.AutoTypeCheckHandlerTest$Model\"}";
        JSONException error = null;
        try {
            JSON.parse(str, config);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

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

    public void test_create() throws Exception {
        Entity entity = JSON.parseObject("{\"values\":[{}]}", Entity.class);
        Assert.assertEquals(1, entity.values.size());
        Assert.assertEquals(Value.class, entity.values.get(0).getClass());
    }


            

Reported by PMD.

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

Line: 17

              
    public void test_create() throws Exception {
        Entity entity = JSON.parseObject("{\"values\":[{}]}", Entity.class);
        Assert.assertEquals(1, entity.values.size());
        Assert.assertEquals(Value.class, entity.values.get(0).getClass());
    }


    public static class Entity {

            

Reported by PMD.

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

Line: 18

                  public void test_create() throws Exception {
        Entity entity = JSON.parseObject("{\"values\":[{}]}", Entity.class);
        Assert.assertEquals(1, entity.values.size());
        Assert.assertEquals(Value.class, entity.values.get(0).getClass());
    }


    public static class Entity {


            

Reported by PMD.

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

Line: 18

                  public void test_create() throws Exception {
        Entity entity = JSON.parseObject("{\"values\":[{}]}", Entity.class);
        Assert.assertEquals(1, entity.values.size());
        Assert.assertEquals(Value.class, entity.values.get(0).getClass());
    }


    public static class Entity {


            

Reported by PMD.