The following issues were found

src/test/java/com/alibaba/json/bvt/guava/ArrayListMultimapTest.java
7 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 14

               * Created by wenshao on 15/01/2017.
 */
public class ArrayListMultimapTest extends TestCase {
    public void test_for_multimap() throws Exception {
        ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.putAll("b", Ints.asList(2, 4, 6));
        multimap.putAll("a", Ints.asList(4, 2, 1));
        multimap.putAll("c", Ints.asList(2, 5, 3));


            

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

               * Created by wenshao on 15/01/2017.
 */
public class ArrayListMultimapTest extends TestCase {
    public void test_for_multimap() throws Exception {
        ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.putAll("b", Ints.asList(2, 4, 6));
        multimap.putAll("a", Ints.asList(4, 2, 1));
        multimap.putAll("c", Ints.asList(2, 5, 3));


            

Reported by PMD.

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

Line: 16

              public class ArrayListMultimapTest extends TestCase {
    public void test_for_multimap() throws Exception {
        ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.putAll("b", Ints.asList(2, 4, 6));
        multimap.putAll("a", Ints.asList(4, 2, 1));
        multimap.putAll("c", Ints.asList(2, 5, 3));

        String json = JSON.toJSONString(multimap, SerializerFeature.MapSortField);
        assertEquals("{\"a\":[4,2,1],\"b\":[2,4,6],\"c\":[2,5,3]}", json);

            

Reported by PMD.

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

Line: 17

                  public void test_for_multimap() throws Exception {
        ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.putAll("b", Ints.asList(2, 4, 6));
        multimap.putAll("a", Ints.asList(4, 2, 1));
        multimap.putAll("c", Ints.asList(2, 5, 3));

        String json = JSON.toJSONString(multimap, SerializerFeature.MapSortField);
        assertEquals("{\"a\":[4,2,1],\"b\":[2,4,6],\"c\":[2,5,3]}", json);


            

Reported by PMD.

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

Line: 18

                      ArrayListMultimap<String, Integer> multimap = ArrayListMultimap.create();
        multimap.putAll("b", Ints.asList(2, 4, 6));
        multimap.putAll("a", Ints.asList(4, 2, 1));
        multimap.putAll("c", Ints.asList(2, 5, 3));

        String json = JSON.toJSONString(multimap, SerializerFeature.MapSortField);
        assertEquals("{\"a\":[4,2,1],\"b\":[2,4,6],\"c\":[2,5,3]}", json);

        TreeMultimap treeMultimap = TreeMultimap.create(multimap);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      multimap.putAll("c", Ints.asList(2, 5, 3));

        String json = JSON.toJSONString(multimap, SerializerFeature.MapSortField);
        assertEquals("{\"a\":[4,2,1],\"b\":[2,4,6],\"c\":[2,5,3]}", json);

        TreeMultimap treeMultimap = TreeMultimap.create(multimap);
        String json2 = JSON.toJSONString(treeMultimap);
        assertEquals("{\"a\":[1,2,4],\"b\":[2,4,6],\"c\":[2,3,5]}", json2);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

              
        TreeMultimap treeMultimap = TreeMultimap.create(multimap);
        String json2 = JSON.toJSONString(treeMultimap);
        assertEquals("{\"a\":[1,2,4],\"b\":[2,4,6],\"c\":[2,3,5]}", json2);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1100/Issue1112.java
7 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 01/04/2017.
 */
public class Issue1112 extends TestCase {
    public void test_for_issue_1() throws Exception {
        JSONObject object = new JSONObject();
        object.put("123", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.123"));
    }

            

Reported by PMD.

The String literal 'abc' appears 6 times in this file; the first occurrence is on line 13
Error

Line: 13

              public class Issue1112 extends TestCase {
    public void test_for_issue_1() throws Exception {
        JSONObject object = new JSONObject();
        object.put("123", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.123"));
    }

    public void test_for_issue_2() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      JSONObject object = new JSONObject();
        object.put("123", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.123"));
    }

    public void test_for_issue_2() throws Exception {
        JSONObject object = new JSONObject();
        object.put("345_xiu", "abc");

            

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

                      assertEquals("abc", JSONPath.eval(object, "$.123"));
    }

    public void test_for_issue_2() throws Exception {
        JSONObject object = new JSONObject();
        object.put("345_xiu", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.345_xiu"));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      JSONObject object = new JSONObject();
        object.put("345_xiu", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.345_xiu"));
    }


    public void test_for_issue_3() throws Exception {
        JSONObject object = new JSONObject();

            

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

                  }


    public void test_for_issue_3() throws Exception {
        JSONObject object = new JSONObject();
        object.put("345.xiu", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.345\\.xiu"));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

                      JSONObject object = new JSONObject();
        object.put("345.xiu", "abc");

        assertEquals("abc", JSONPath.eval(object, "$.345\\.xiu"));
    }
}

            

Reported by PMD.

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

Line: 19

              
        // {"id":1001,"name":"gaotie"}
        String text_normal = JSON.toJSONString(model);
        System.out.println(text_normal);

        // [1001,"gaotie"]
        String text_beanToArray = JSON.toJSONString(model,
                SerializerFeature.BeanToArray);
        System.out.println(text_beanToArray);

            

Reported by PMD.

System.out.println is used
Design

Line: 24

                      // [1001,"gaotie"]
        String text_beanToArray = JSON.toJSONString(model,
                SerializerFeature.BeanToArray);
        System.out.println(text_beanToArray);

        // support beanToArray & normal mode
        System.out.println(JSON.parseObject(text_beanToArray, Model.class, Feature.SupportArrayToBean));
    }


            

Reported by PMD.

System.out.println is used
Design

Line: 27

                      System.out.println(text_beanToArray);

        // support beanToArray & normal mode
        System.out.println(JSON.parseObject(text_beanToArray, Model.class, Feature.SupportArrayToBean));
    }

    static class Model {
        public int id;
        public String name;

            

Reported by PMD.

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

Line: 12

               * Created by wenshao on 10/04/2017.
 */
public class Issue1138 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "gaotie";

        // {"id":1001,"name":"gaotie"}

            

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 10/04/2017.
 */
public class Issue1138 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.id = 1001;
        model.name = "gaotie";

        // {"id":1001,"name":"gaotie"}

            

Reported by PMD.

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

Line: 31

                  }

    static class Model {
        public int id;
        public String name;
    }

}

            

Reported by PMD.

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

Line: 32

              
    static class Model {
        public int id;
        public String name;
    }

}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1100/Issue1152.java
7 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 08/05/2017.
 */
public class Issue1152 extends TestCase {
    public void test_for_issue() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0000-00-00T00:00:00\"}",TestBean.class);
        assertNull(tb.getShijian());
    }

    public void test_for_issue_2() throws Exception {

            

Reported by PMD.

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

Line: 16

              public class Issue1152 extends TestCase {
    public void test_for_issue() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0000-00-00T00:00:00\"}",TestBean.class);
        assertNull(tb.getShijian());
    }

    public void test_for_issue_2() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0001-01-01T00:00:00+08:00\"}",TestBean.class);
        assertNotNull(tb.getShijian());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

              public class Issue1152 extends TestCase {
    public void test_for_issue() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0000-00-00T00:00:00\"}",TestBean.class);
        assertNull(tb.getShijian());
    }

    public void test_for_issue_2() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0001-01-01T00:00:00+08:00\"}",TestBean.class);
        assertNotNull(tb.getShijian());

            

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

                      assertNull(tb.getShijian());
    }

    public void test_for_issue_2() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0001-01-01T00:00:00+08:00\"}",TestBean.class);
        assertNotNull(tb.getShijian());
    }

    public static class TestBean {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

              
    public void test_for_issue_2() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0001-01-01T00:00:00+08:00\"}",TestBean.class);
        assertNotNull(tb.getShijian());
    }

    public static class TestBean {

        private Date shijian;

            

Reported by PMD.

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

Line: 21

              
    public void test_for_issue_2() throws Exception {
        TestBean tb = JSONObject.parseObject("{shijian:\"0001-01-01T00:00:00+08:00\"}",TestBean.class);
        assertNotNull(tb.getShijian());
    }

    public static class TestBean {

        private Date shijian;

            

Reported by PMD.

Avoid unused imports such as 'java.text.SimpleDateFormat'
Design

Line: 7

              import com.alibaba.fastjson.annotation.JSONField;
import junit.framework.TestCase;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by wenshao on 08/05/2017.
 */

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1200/Issue1254.java
7 issues
System.out.println is used
Design

Line: 15

                      A a = new A();
        a._parentId = "001";
        String test = JSON.toJSONString(a);
        System.out.println(test);
        assertEquals("{\"_parentId\":\"001\"}", test);

        B b = new B();
        b.set_parentId("001");


            

Reported by PMD.

System.out.println is used
Design

Line: 23

              

        String testB = JSON.toJSONString(b);
        System.out.println(testB);
        assertEquals("{\"_parentId\":\"001\"}", testB);

    }

    public static class A {

            

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

               * Created by kimmking on 09/06/2017.
 */
public class Issue1254 extends TestCase {
    public void test_for_issue() throws Exception {
        A a = new A();
        a._parentId = "001";
        String test = JSON.toJSONString(a);
        System.out.println(test);
        assertEquals("{\"_parentId\":\"001\"}", test);

            

Reported by PMD.

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

Line: 11

               * Created by kimmking on 09/06/2017.
 */
public class Issue1254 extends TestCase {
    public void test_for_issue() throws Exception {
        A a = new A();
        a._parentId = "001";
        String test = JSON.toJSONString(a);
        System.out.println(test);
        assertEquals("{\"_parentId\":\"001\"}", test);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      a._parentId = "001";
        String test = JSON.toJSONString(a);
        System.out.println(test);
        assertEquals("{\"_parentId\":\"001\"}", test);

        B b = new B();
        b.set_parentId("001");



            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

              
        String testB = JSON.toJSONString(b);
        System.out.println(testB);
        assertEquals("{\"_parentId\":\"001\"}", testB);

    }

    public static class A {
        public String _parentId;

            

Reported by PMD.

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

Line: 29

                  }

    public static class A {
        public String _parentId;
    }

    public static class B {
        @JSONField(name = "_parentId")
        private String _parentId;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1200/Issue1265.java
7 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 22/07/2017.
 */
public class Issue1265 extends TestCase {
    public void test_0() throws Exception {
        Object t = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response>(){}).value;
        assertEquals(123, ((JSONObject) t).getIntValue("id"));

        T1 t1 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T1>>(){}).value;
        assertEquals(123, t1.id);

            

Reported by PMD.

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

Line: 12

               * Created by wenshao on 22/07/2017.
 */
public class Issue1265 extends TestCase {
    public void test_0() throws Exception {
        Object t = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response>(){}).value;
        assertEquals(123, ((JSONObject) t).getIntValue("id"));

        T1 t1 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T1>>(){}).value;
        assertEquals(123, t1.id);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

              public class Issue1265 extends TestCase {
    public void test_0() throws Exception {
        Object t = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response>(){}).value;
        assertEquals(123, ((JSONObject) t).getIntValue("id"));

        T1 t1 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T1>>(){}).value;
        assertEquals(123, t1.id);

        T2 t2 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T2>>(){}).value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      assertEquals(123, ((JSONObject) t).getIntValue("id"));

        T1 t1 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T1>>(){}).value;
        assertEquals(123, t1.id);

        T2 t2 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T2>>(){}).value;
        assertEquals(123, t2.id);

    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      assertEquals(123, t1.id);

        T2 t2 = JSON.parseObject("{\"value\":{\"id\":123}}", new TypeReference<Response<T2>>(){}).value;
        assertEquals(123, t2.id);

    }

    public static class Response<T> {
        public T value;

            

Reported by PMD.

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

Line: 29

                  }

    public static class T1 {
        public int id;
    }

    public static class T2 {
        public int id;
    }

            

Reported by PMD.

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

Line: 33

                  }

    public static class T2 {
        public int id;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1200/Issue1293.java
7 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 12

               */
public class Issue1293 extends TestCase {

    public void test_for_issue() {
        String data = "{\"idType\":\"123123\",\"userType\":\"134\",\"count\":\"123123\"}";
        {
            Test test = JSON.parseObject(data, Test.class);

            assertNull(test.idType);

            

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

               */
public class Issue1293 extends TestCase {

    public void test_for_issue() {
        String data = "{\"idType\":\"123123\",\"userType\":\"134\",\"count\":\"123123\"}";
        {
            Test test = JSON.parseObject(data, Test.class);

            assertNull(test.idType);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      {
            Test test = JSON.parseObject(data, Test.class);

            assertNull(test.idType);
            assertNull(test.userType);
        }

        Test test = JSON.parseObject(data, Test.class);
        assertNull(test.idType);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                          Test test = JSON.parseObject(data, Test.class);

            assertNull(test.idType);
            assertNull(test.userType);
        }

        Test test = JSON.parseObject(data, Test.class);
        assertNull(test.idType);
        assertNull(test.userType);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      }

        Test test = JSON.parseObject(data, Test.class);
        assertNull(test.idType);
        assertNull(test.userType);

    }

    static class Test{

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
        Test test = JSON.parseObject(data, Test.class);
        assertNull(test.idType);
        assertNull(test.userType);

    }

    static class Test{
        private long count;

            

Reported by PMD.

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

Line: 27

              
    }

    static class Test{
        private long count;
        private IdType idType;
        private UserType userType;

        public long getCount() {

            

Reported by PMD.

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

Line: 13

              public class Issue1344 extends TestCase {
    public void test_for_issue() throws Exception {
        TestException testException = new TestException("aaa");
        System.out.println("before:" + testException.getMessage());
        String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.class);
        System.out.println("after:" + o.getMessage());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 15

                      TestException testException = new TestException("aaa");
        System.out.println("before:" + testException.getMessage());
        String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.class);
        System.out.println("after:" + o.getMessage());
    }

    public static class TestException extends Exception {

            

Reported by PMD.

System.out.println is used
Design

Line: 17

                      String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.class);
        System.out.println("after:" + o.getMessage());
    }

    public static class TestException extends Exception {

        @JSONCreator

            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 26/07/2017.
 */
public class Issue1344 extends TestCase {
    public void test_for_issue() throws Exception {
        TestException testException = new TestException("aaa");
        System.out.println("before:" + testException.getMessage());
        String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.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: 11

               * Created by wenshao on 26/07/2017.
 */
public class Issue1344 extends TestCase {
    public void test_for_issue() throws Exception {
        TestException testException = new TestException("aaa");
        System.out.println("before:" + testException.getMessage());
        String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.class);

            

Reported by PMD.

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

Line: 17

                      String json = JSONObject.toJSONString(testException);
        System.out.println(json);
        TestException o = JSONObject.parseObject(json, TestException.class);
        System.out.println("after:" + o.getMessage());
    }

    public static class TestException extends Exception {

        @JSONCreator

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 20

                      System.out.println("after:" + o.getMessage());
    }

    public static class TestException extends Exception {

        @JSONCreator
        public TestException() {

        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1500/Issue1524.java
7 issues
System.out.println is used
Design

Line: 27

                              return name;
            }
        });
        System.out.println(json);
    }

    public static class Model {
        @JSONField(serializeUsing = ValueSerializer.class)
        public Value oldValue;

            

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

              import java.lang.reflect.Type;

public class Issue1524 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.oldValue = new Value();

        String json = JSON.toJSONString(model, new NameFilter() {
            public String process(Object object, String name, Object value) {

            

Reported by PMD.

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

Line: 15

              import java.lang.reflect.Type;

public class Issue1524 extends TestCase {
    public void test_for_issue() throws Exception {
        Model model = new Model();
        model.oldValue = new Value();

        String json = JSON.toJSONString(model, new NameFilter() {
            public String process(Object object, String name, Object value) {

            

Reported by PMD.

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

Line: 32

              
    public static class Model {
        @JSONField(serializeUsing = ValueSerializer.class)
        public Value oldValue;
    }

    public static class Value {

    }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.annotation.JSONType'
Design

Line: 5

              
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.NameFilter;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import junit.framework.TestCase;


            

Reported by PMD.

Found 'DU'-anomaly for variable 'json' (lines '19'-'28').
Error

Line: 19

                      Model model = new Model();
        model.oldValue = new Value();

        String json = JSON.toJSONString(model, new NameFilter() {
            public String process(Object object, String name, Object value) {
                if ("oldValue".equals(name)) {
                    return "old_value";
                }
                return name;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'json' (lines '19'-'28').
Error

Line: 19

                      Model model = new Model();
        model.oldValue = new Value();

        String json = JSON.toJSONString(model, new NameFilter() {
            public String process(Object object, String name, Object value) {
                if ("oldValue".equals(name)) {
                    return "old_value";
                }
                return name;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue1612.java
7 issues
System.out.println is used
Design

Line: 23

                      RegResponse<User> userRegResponse = testFastJson(User.class);

        User user = userRegResponse.getResult();
        System.out.println(user);

    }

    public static <T> RegResponse<T> testFastJson(Class<T> clasz) {


            

Reported by PMD.

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

Line: 18

              public class Issue1612 {

    @Test
    public void test() {

        RegResponse<User> userRegResponse = testFastJson(User.class);

        User user = userRegResponse.getResult();
        System.out.println(user);

            

Reported by PMD.

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

Line: 22

              
        RegResponse<User> userRegResponse = testFastJson(User.class);

        User user = userRegResponse.getResult();
        System.out.println(user);

    }

    public static <T> RegResponse<T> testFastJson(Class<T> clasz) {

            

Reported by PMD.

The class 'RegResponse' is suspected to be a Data Class (WOC=14.286%, NOPA=0, NOAM=6, WMC=7)
Design

Line: 36

                  }
}

class RegResponse<T> {

    private String retCode;
    private String retDesc;
    private T result;


            

Reported by PMD.

This class name ends with Test but contains no test cases
Error

Line: 36

                  }
}

class RegResponse<T> {

    private String retCode;
    private String retDesc;
    private T result;


            

Reported by PMD.

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

Line: 76

                  }
}

class User {

    public User(){}
    public User(String username, String password) {
        this.username = username;
        this.password = password;

            

Reported by PMD.

This class name ends with Test but contains no test cases
Error

Line: 76

                  }
}

class User {

    public User(){}
    public User(String username, String password) {
        this.username = username;
        this.password = password;

            

Reported by PMD.