The following issues were found

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

              import junit.framework.TestCase;

public class BigSpecailKeyTest extends TestCase {
    public void test_big_special_key() throws Exception {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < 16; ++i) {
            buf.append('\\');
            buf.append('\"');
            char[] chars = new char[1024];

            

Reported by PMD.

StringBuffer (or StringBuilder).append is called 2 consecutive times with literals. Use a single append with a single combined String.
Performance

Line: 18

                  public void test_big_special_key() throws Exception {
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < 16; ++i) {
            buf.append('\\');
            buf.append('\"');
            char[] chars = new char[1024];
            Arrays.fill(chars, '0');
            buf.append(chars);
        }

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 20

                      for (int i = 0; i < 16; ++i) {
            buf.append('\\');
            buf.append('\"');
            char[] chars = new char[1024];
            Arrays.fill(chars, '0');
            buf.append(chars);
        }
        
        String key = buf.toString();

            

Reported by PMD.

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

Line: 32

                      
        String text = JSON.toJSONString(map);
        JSONObject obj = JSON.parseObject(text);
        Assert.assertEquals(map.get(key), obj.get(key));
    }
}

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 15/08/2017.
 */
public class Issue1399 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("false", boolean.class);
        JSON.parseObject("false", Boolean.class);
        JSON.parseObject("\"false\"", boolean.class);
        JSON.parseObject("\"false\"", Boolean.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: 10

               * Created by wenshao on 15/08/2017.
 */
public class Issue1399 extends TestCase {
    public void test_for_issue() throws Exception {
        JSON.parseObject("false", boolean.class);
        JSON.parseObject("false", Boolean.class);
        JSON.parseObject("\"false\"", boolean.class);
        JSON.parseObject("\"false\"", Boolean.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: 22

                      JSON.parseObject("\"FALSE\"", Boolean.class);
    }

    public void test_for_issue_true() throws Exception {
        JSON.parseObject("true", boolean.class);
        JSON.parseObject("true", Boolean.class);
        JSON.parseObject("\"true\"", boolean.class);
        JSON.parseObject("\"true\"", Boolean.class);


            

Reported by PMD.

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

Line: 22

                      JSON.parseObject("\"FALSE\"", Boolean.class);
    }

    public void test_for_issue_true() throws Exception {
        JSON.parseObject("true", boolean.class);
        JSON.parseObject("true", Boolean.class);
        JSON.parseObject("\"true\"", boolean.class);
        JSON.parseObject("\"true\"", Boolean.class);


            

Reported by PMD.

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

               * Created by wenshao on 06/08/2017.
 */
public class Issue1375 extends TestCase {
    public void test_issue() throws Exception {
        assertSame(CollectionCodec.instance
                , SerializeConfig.getGlobalInstance()
                        .getObjectWriter(LinkedList.class));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

               */
public class Issue1375 extends TestCase {
    public void test_issue() throws Exception {
        assertSame(CollectionCodec.instance
                , SerializeConfig.getGlobalInstance()
                        .getObjectWriter(LinkedList.class));
    }
}

            

Reported by PMD.

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

Line: 15

              public class Issue1375 extends TestCase {
    public void test_issue() throws Exception {
        assertSame(CollectionCodec.instance
                , SerializeConfig.getGlobalInstance()
                        .getObjectWriter(LinkedList.class));
    }
}

            

Reported by PMD.

Avoid using implementation types like 'LinkedList'; use the interface instead
Design

Line: 16

                  public void test_issue() throws Exception {
        assertSame(CollectionCodec.instance
                , SerializeConfig.getGlobalInstance()
                        .getObjectWriter(LinkedList.class));
    }
}

            

Reported by PMD.

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

Line: 16

              
        String str = "{\"d2\":null}";
        Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
        System.out.println(b);
    }

    public static class Test2Bean{
        private LocalDateTime d2;


            

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

               * Created by wenshao on 31/07/2017.
 */
public class Issue1357 extends TestCase {
    public void test_for_issue() throws Exception {

        String str = "{\"d2\":null}";
        Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
        System.out.println(b);
    }

            

Reported by PMD.

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

Line: 12

               * Created by wenshao on 31/07/2017.
 */
public class Issue1357 extends TestCase {
    public void test_for_issue() throws Exception {

        String str = "{\"d2\":null}";
        Test2Bean b = JSONObject.parseObject(str,Test2Bean.class);
        System.out.println(b);
    }

            

Reported by PMD.

Avoid unused private fields such as 'd2'.
Design

Line: 20

                  }

    public static class Test2Bean{
        private LocalDateTime d2;

    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1300/Issue1310_noasm.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: 11

               * Created by wenshao on 29/07/2017.
 */
public class Issue1310_noasm extends TestCase {
    public void test_trim() throws Exception {
        Model model = new Model();
        model.value = " a ";

        assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));


            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 29/07/2017.
 */
public class Issue1310_noasm extends TestCase {
    public void test_trim() throws Exception {
        Model model = new Model();
        model.value = " a ";

        assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      Model model = new Model();
        model.value = " a ";

        assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));

        Model model2 = JSON.parseObject("{\"value\":\" a \"}", Model.class);
        assertEquals("a", model2.value);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      assertEquals("{\"value\":\"a\"}", JSON.toJSONString(model));

        Model model2 = JSON.parseObject("{\"value\":\" a \"}", Model.class);
        assertEquals("a", model2.value);
    }

    private static class Model {
        @JSONField(format = "trim")
        private String value;

            

Reported by PMD.

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

              
public class DefaultExtJSONParserTest_6 extends TestCase {

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

            

Reported by PMD.

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

Line: 16

                      parser.config(Feature.AllowArbitraryCommas, true);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue().getValue());
    }

    public void test_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("{'value':{\"value\":3,\"id\":1}}");
        parser.config(Feature.AllowArbitraryCommas, false);

            

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().getValue());
    }

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

            

Reported by PMD.

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

Line: 24

                      parser.config(Feature.AllowArbitraryCommas, false);
        Entity entity = new Entity();
        parser.parseObject(entity);
        Assert.assertEquals(3, entity.getValue().getValue());
    }

    public static class Entity {

        private V1 value;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1200/Issue1272_IgnoreError.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 18/06/2017.
 */
public class Issue1272_IgnoreError extends TestCase {
    public void test_for_issue() throws Exception {
        String text = JSON.toJSONString(new Point(), SerializerFeature.IgnoreErrorGetter);
        assertEquals("{}", text);
    }

    public static class Point {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

              public class Issue1272_IgnoreError extends TestCase {
    public void test_for_issue() throws Exception {
        String text = JSON.toJSONString(new Point(), SerializerFeature.IgnoreErrorGetter);
        assertEquals("{}", text);
    }

    public static class Point {

        private Long userId;

            

Reported by PMD.

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

Line: 19

              
    public static class Point {

        private Long userId;

        public long getUserId() {
            return userId;
        }
    }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.JSONException'
Design

Line: 4

              package com.alibaba.json.bvt.issue_1200;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;

/**
 * Created by wenshao on 18/06/2017.

            

Reported by PMD.

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

               * Created by wenshao on 15/06/2017.
 */
public class Issue1262 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
    }

    public static class Model {
        public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 15/06/2017.
 */
public class Issue1262 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
    }

    public static class Model {
        public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 14

               */
public class Issue1262 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
    }

    public static class Model {
        public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
    }

            

Reported by PMD.

Found 'DU'-anomaly for variable 'model' (lines '14'-'15').
Error

Line: 14

               */
public class Issue1262 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = JSON.parseObject("{\"chatterMap\":{}}", Model.class);
    }

    public static class Model {
        public Map<String, Chatter> chatterMap = new ConcurrentHashMap<String, Chatter>();
    }

            

Reported by PMD.

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

    public void test_parse() throws Exception {
        JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
    }

    public void test_parse_error() throws Exception {
        Exception error = null;

            

Reported by PMD.

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

Line: 13

              
public class InetSocketAddressTest extends TestCase {

    public void test_parse() throws Exception {
        JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
    }

    public void test_parse_error() throws Exception {
        Exception error = null;

            

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

                      JSON.parseObject("{\"address\":'10.20.133.23',\"port\":123,\"xx\":33}", InetSocketAddress.class);
    }

    public void test_parse_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"address\":'10.20.133.23',\"port\":'12.3',\"xx\":33}", InetSocketAddress.class);
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '18'-'22').
Error

Line: 18

                  }

    public void test_parse_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"address\":'10.20.133.23',\"port\":'12.3',\"xx\":33}", InetSocketAddress.class);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

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

Line: 18

                  public void test_for_issue() throws Exception {
        String text = "{\"models\":[{\"x\":\"y\"},{\"x\":\"y\"}]}";
        Root root = JSONObject.parseObject(text, Root.class);
        System.out.println(JSON.toJSONString(root));
        String jsonpath = "$..x";
        String value="y2";
        JSONPath.set(root, jsonpath, value);
        assertEquals("{\"models\":[{\"x\":\"y2\"},{\"x\":\"y2\"}]}", JSON.toJSONString(root));


            

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

               * Created by wenshao on 05/05/2017.
 */
public class Issue1177_4 extends TestCase {
    public void test_for_issue() throws Exception {
        String text = "{\"models\":[{\"x\":\"y\"},{\"x\":\"y\"}]}";
        Root root = JSONObject.parseObject(text, Root.class);
        System.out.println(JSON.toJSONString(root));
        String jsonpath = "$..x";
        String value="y2";

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      String jsonpath = "$..x";
        String value="y2";
        JSONPath.set(root, jsonpath, value);
        assertEquals("{\"models\":[{\"x\":\"y2\"},{\"x\":\"y2\"}]}", JSON.toJSONString(root));

    }

    public static class Root {
        public List<Model> models;

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.TypeReference'
Design

Line: 6

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import com.alibaba.fastjson.TypeReference;
import junit.framework.TestCase;

import java.util.List;

/**

            

Reported by PMD.