The following issues were found

src/test/java/com/alibaba/json/bvt/feature/FeaturesTest5.java
3 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 FeaturesTest5 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\":false}", 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\":false}", text);
    }
    
    public void test_1() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setAsmEnable(true);
        
        String text = JSON.toJSONString(new Entity(), config);
        Assert.assertEquals("{\"value\":false}", text);

            

Reported by PMD.

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

Line: 31

              
    public static class Entity {

        private Boolean value;

        @JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullBooleanAsFalse })
        public Boolean getValue() {
            return value;
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/feature/FeaturesTest4.java
3 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 FeaturesTest4 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\":\"\"}", 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\":\"\"}", text);
    }
    
    public void test_1() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setAsmEnable(true);
        
        String text = JSON.toJSONString(new Entity(), config);
        Assert.assertEquals("{\"value\":\"\"}", text);

            

Reported by PMD.

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

Line: 31

              
    public static class Entity {

        private String value;

        @JSONField(serialzeFeatures = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty })
        public String getValue() {
            return value;
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2200/Issue2240.java
3 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 java.util.Map;

public class Issue2240 extends TestCase {
    public void test_for_issue() throws Exception {
        ResultMap resultMap = new ResultMap();
        resultMap.setA(Collections.<Long, Integer>emptyMap());
        resultMap.setB(Collections.<Long, Integer>emptyMap());
        assertEquals("{\"a\":{},\"b\":{}}", JSON.toJSONString(resultMap));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      ResultMap resultMap = new ResultMap();
        resultMap.setA(Collections.<Long, Integer>emptyMap());
        resultMap.setB(Collections.<Long, Integer>emptyMap());
        assertEquals("{\"a\":{},\"b\":{}}", JSON.toJSONString(resultMap));

    }

    public static class ResultMap {
        private Map<Long, Integer> a;

            

Reported by PMD.

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

Line: 18

              
    }

    public static class ResultMap {
        private Map<Long, Integer> a;
        private Map<Long, Integer> b;

        public Map<Long, Integer> getA() {
            return a;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/kotlin/ClassWithTripleTest.java
3 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

               * Created by wenshao on 06/08/2017.
 */
public class ClassWithTripleTest extends TestCase {
    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("ClassWithTriple");

        String json = "{\"name\":{\"first\":\"wen\",\"second\":\"shaojin\",\"third\":99}}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        String json = "{\"name\":{\"first\":\"wen\",\"second\":\"shaojin\",\"third\":99}}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"age\":0,\"name\":{\"first\":\"wen\",\"second\":\"shaojin\",\"third\":\"99\"}}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/kotlin/Class_WithPrimaryAndSecondaryConstructorTest.java
3 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

               * Created by wenshao on 06/08/2017.
 */
public class Class_WithPrimaryAndSecondaryConstructorTest extends TestCase {
    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("Class_WithPrimaryAndSecondaryConstructor");

        String json = "{\"name\":\"John Smith\",\"age\":30}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        String json = "{\"name\":\"John Smith\",\"age\":30}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"age\":30,\"name\":\"John Smith\"}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/kotlin/ClassWithRangesTest.java
3 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

               * Created by wenshao on 06/08/2017.
 */
public class ClassWithRangesTest extends TestCase {
    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("ClassWithRanges");

        String json = "{\"ages\":{\"start\":18,\"end\":40},\"distance\":{\"start\":5,\"end\":50}}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        String json = "{\"ages\":{\"start\":18,\"end\":40},\"distance\":{\"start\":5,\"end\":50}}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"ages\":{\"first\":18,\"last\":0,\"start\":18,\"step\":1},\"distance\":{\"first\":5,\"last\":0,\"start\":5,\"step\":1}}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

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

    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("DataClass");

        String json = "{\"aa\":1001,\"bb\":1002}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

              
        String json = "{\"aa\":1001,\"bb\":1002}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"aa\":1001,\"bb\":1002}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/kotlin/Issue1420.java
3 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 java.io.InputStream;

public class Issue1420 extends TestCase {
    public void test_for_issue() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("A");

        String json = "{\"id\":1,\"name\":\"a\"}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

              
        String json = "{\"id\":1,\"name\":\"a\"}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"id\":1,\"name\":\"a\"}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

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

    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("ObjectA");

        String json = "{\"a\":1001,\"b\":1002}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

              
        String json = "{\"a\":1001,\"b\":1002}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"a\":\"b\",\"b\":\"b\"}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/kotlin/ClassWithPairTest.java
3 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

               * Created by wenshao on 06/08/2017.
 */
public class ClassWithPairTest extends TestCase {
    public void test_user() throws Exception {
        ExtClassLoader classLoader = new ExtClassLoader();
        Class clazz = classLoader.loadClass("ClassWithPair");

        String json = "{\"name\":{\"first\":\"shaojin\",\"second\":\"wen\"},\"age\":99}";
        Object obj = JSON.parseObject(json, clazz);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        String json = "{\"name\":{\"first\":\"shaojin\",\"second\":\"wen\"},\"age\":99}";
        Object obj = JSON.parseObject(json, clazz);
        assertEquals("{\"age\":99,\"name\":{\"first\":\"shaojin\",\"second\":\"wen\"}}", JSON.toJSONString(obj));
    }

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

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

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

            

Reported by PMD.