The following issues were found

src/test/java/com/alibaba/json/bvt/parser/deser/deny/DenyTest14.java
5 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/01/2017.
 */
public class DenyTest14 extends TestCase {
    public void test_deny() throws Exception {
        String text = "{\"value\":{\"@type\":\"com.alibaba.json.bvt.parser.deser.deny.DenyTest14$MyException\"}}";
        Model model = JSON.parseObject(text, Model.class);
        assertTrue(model.value instanceof MyException);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                  public void test_deny() throws Exception {
        String text = "{\"value\":{\"@type\":\"com.alibaba.json.bvt.parser.deser.deny.DenyTest14$MyException\"}}";
        Model model = JSON.parseObject(text, Model.class);
        assertTrue(model.value instanceof MyException);
    }

    public static class Model {
        public Throwable value;
    }

            

Reported by PMD.

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

Line: 18

                  }

    public static class Model {
        public Throwable value;
    }

    public static class MyException extends Exception {

    }

            

Reported by PMD.

Classes implementing Serializable should set a serialVersionUID
Error

Line: 21

                      public Throwable value;
    }

    public static class MyException extends Exception {

    }
}

            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.parser.deser.deny;

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

/**
 * Created by wenshao on 29/01/2017.
 */

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_paths_test5.java
5 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

               */
public class JSONPath_paths_test5 extends TestCase {

    public void test_array() throws Exception {
        String[] array = new String[]{"1001", "wenshao"};

        Map<String, Object> paths = JSONPath.paths(array);

        Assert.assertEquals(3, paths.size());

            

Reported by PMD.

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

Line: 19

              
        Map<String, Object> paths = JSONPath.paths(array);

        Assert.assertEquals(3, paths.size());
        Assert.assertSame(array, paths.get("/"));
        Assert.assertEquals("1001", paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 20

                      Map<String, Object> paths = JSONPath.paths(array);

        Assert.assertEquals(3, paths.size());
        Assert.assertSame(array, paths.get("/"));
        Assert.assertEquals("1001", paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 21

              
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(array, paths.get("/"));
        Assert.assertEquals("1001", paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals(3, paths.size());
        Assert.assertSame(array, paths.get("/"));
        Assert.assertEquals("1001", paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_short.java
5 issues
Do not use the short type
Performance

Line: 19

              
    public static class V0 {

        private short i = 12;

        public short getI() {
            return i;
        }


            

Reported by PMD.

Do not use the short type
Performance

Line: 21

              
        private short i = 12;

        public short getI() {
            return i;
        }

        public void setI(short i) {
            this.i = i;

            

Reported by PMD.

Do not use the short type
Performance

Line: 25

                          return i;
        }

        public void setI(short i) {
            this.i = i;
        }

    }
}

            

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

              
public class TestASM_short extends TestCase {

    public void test_asm() throws Exception {
        V0 v = new V0();
        String text = JSON.toJSONString(v);
        V0 v1 = JSON.parseObject(text, V0.class);
        Assert.assertEquals(v.getI(), v1.getI());
    }

            

Reported by PMD.

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

Line: 14

                      V0 v = new V0();
        String text = JSON.toJSONString(v);
        V0 v1 = JSON.parseObject(text, V0.class);
        Assert.assertEquals(v.getI(), v1.getI());
    }

    public static class V0 {

        private short i = 12;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_primitive.java
5 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

              
public class TestASM_primitive extends TestCase {

    public void test_asm() throws Exception {

        ASMDeserializerFactory factory = new ASMDeserializerFactory(new ASMClassLoader());
        Exception error = null;
        try {
            JavaBeanInfo beanInfo = JavaBeanInfo.build(int.class, int.class, null);

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 21

                      try {
            JavaBeanInfo beanInfo = JavaBeanInfo.build(int.class, int.class, null);
            factory.createJavaBeanDeserializer(ParserConfig.getGlobalInstance(), beanInfo);
        } catch (Exception ex) {
            error = ex;
        }
        assertNotNull(error);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

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

}

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 3

              package com.alibaba.json.bvt.parser.deser.asm;

import org.junit.Assert;

import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory;
import com.alibaba.fastjson.util.ASMClassLoader;
import com.alibaba.fastjson.util.JavaBeanInfo;


            

Reported by PMD.

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

Line: 17

                  public void test_asm() throws Exception {

        ASMDeserializerFactory factory = new ASMDeserializerFactory(new ASMClassLoader());
        Exception error = null;
        try {
            JavaBeanInfo beanInfo = JavaBeanInfo.build(int.class, int.class, null);
            factory.createJavaBeanDeserializer(ParserConfig.getGlobalInstance(), beanInfo);
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_paths_test1.java
5 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

              import junit.framework.TestCase;

public class JSONPath_paths_test1 extends TestCase {
    public void test_map() throws Exception {
        List<Object> list = new ArrayList<Object>();
        list.add(1001);
        list.add("wenshao");
        
        

            

Reported by PMD.

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

Line: 22

                      
        Map<String, Object> paths = JSONPath.paths(list);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(list, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 23

                      Map<String, Object> paths = JSONPath.paths(list);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(list, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 24

                      
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(list, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals(3, paths.size());
        Assert.assertSame(list, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/0"));
        Assert.assertEquals("wenshao", paths.get("/1"));
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/support/retrofit/Retrofit2ConverterFactoryTest0.java
5 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: 21

              import java.nio.charset.Charset;

public class Retrofit2ConverterFactoryTest0 extends TestCase {
    public void test_for_coverage() throws Exception {
        Retrofit2ConverterFactory f = new Retrofit2ConverterFactory();
        f.getParserConfig();
        f.getParserFeatures();
        f.getParserFeatureValues();
        f.getSerializeConfig();

            

Reported by PMD.

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

Line: 44

                      final Headers headers = Headers.of("Content-Type", "application/json; charset=UTF-8");
        final ResponseBody body = new RealResponseBody(headers, buffer);

        RequestBody requestBody = Retrofit2ConverterFactory.create()
                .requestBodyConverter(Model.class, null, null, null)
                .convert(model);

        Assert.assertNotEquals(requestBody.contentLength(), 0);


            

Reported by PMD.

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

Line: 44

                      final Headers headers = Headers.of("Content-Type", "application/json; charset=UTF-8");
        final ResponseBody body = new RealResponseBody(headers, buffer);

        RequestBody requestBody = Retrofit2ConverterFactory.create()
                .requestBodyConverter(Model.class, null, null, null)
                .convert(model);

        Assert.assertNotEquals(requestBody.contentLength(), 0);


            

Reported by PMD.

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

Line: 50

              
        Assert.assertNotEquals(requestBody.contentLength(), 0);

        Model mode2 = (Model) Retrofit2ConverterFactory.create()
                .responseBodyConverter(Model.class, null, null)
                .convert(body);

        Assert.assertEquals(JSON.toJSONString(mode2), json);
    }

            

Reported by PMD.

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

Line: 50

              
        Assert.assertNotEquals(requestBody.contentLength(), 0);

        Model mode2 = (Model) Retrofit2ConverterFactory.create()
                .responseBodyConverter(Model.class, null, null)
                .convert(body);

        Assert.assertEquals(JSON.toJSONString(mode2), json);
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_paths_test.java
5 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

              import junit.framework.TestCase;

public class JSONPath_paths_test extends TestCase {
    public void test_map() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("id", 1001);
        map.put("name", "wenshao");
        
        Map<String, Object> paths = JSONPath.paths(map);

            

Reported by PMD.

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

Line: 20

                      
        Map<String, Object> paths = JSONPath.paths(map);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(map, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
}

            

Reported by PMD.

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

Line: 21

                      Map<String, Object> paths = JSONPath.paths(map);
        
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(map, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
}

            

Reported by PMD.

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

Line: 22

                      
        Assert.assertEquals(3, paths.size());
        Assert.assertSame(map, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
}

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(3, paths.size());
        Assert.assertSame(map, paths.get("/"));
        Assert.assertEquals(1001, paths.get("/id"));
        Assert.assertEquals("wenshao", paths.get("/name"));
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_oracle_compatible_test.java
5 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 JSONPath_oracle_compatible_test
        extends TestCase
{
    public void test_reserve() throws Exception {
        JSONObject object = JSON.parseObject(str);

        assertEquals("Sayings of the Century", JSONPath.eval(object, "$.store.book[0].title"));
        assertEquals("Sayings of the Century", JSONPath.eval(object, "$['store']['book'][0]['title']"));
    }

            

Reported by PMD.

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

Line: 11

              public class JSONPath_oracle_compatible_test
        extends TestCase
{
    public void test_reserve() throws Exception {
        JSONObject object = JSON.parseObject(str);

        assertEquals("Sayings of the Century", JSONPath.eval(object, "$.store.book[0].title"));
        assertEquals("Sayings of the Century", JSONPath.eval(object, "$['store']['book'][0]['title']"));
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                  public void test_reserve() throws Exception {
        JSONObject object = JSON.parseObject(str);

        assertEquals("Sayings of the Century", JSONPath.eval(object, "$.store.book[0].title"));
        assertEquals("Sayings of the Century", JSONPath.eval(object, "$['store']['book'][0]['title']"));
    }


    public static final String str = "{\n" +

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      JSONObject object = JSON.parseObject(str);

        assertEquals("Sayings of the Century", JSONPath.eval(object, "$.store.book[0].title"));
        assertEquals("Sayings of the Century", JSONPath.eval(object, "$['store']['book'][0]['title']"));
    }


    public static final String str = "{\n" +
            "    \"store\": {\n" +

            

Reported by PMD.

The String literal ' {\n' appears 4 times in this file; the first occurrence is on line 22
Error

Line: 22

                  public static final String str = "{\n" +
            "    \"store\": {\n" +
            "        \"book\": [\n" +
            "            {\n" +
            "                \"category\": \"reference\",\n" +
            "\n" +
            "                \"author\": \"Nigel Rees\",\n" +
            "\n" +
            "                \"title\": \"Sayings of the Century\",\n" +

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/SerializerFeatureTest.java
5 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 SerializerFeatureTest extends TestCase {
    public void test_0 () throws Exception {
        int feature = 0;
        feature = SerializerFeature.config(feature, SerializerFeature.BrowserCompatible, true);
        Assert.assertEquals(true, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserCompatible));
        feature = SerializerFeature.config(feature, SerializerFeature.BrowserCompatible, false);
        Assert.assertEquals(false, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserCompatible));

            

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

                      Assert.assertEquals(false, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserCompatible));
    }
    
    public void test_1 () throws Exception {
        int feature = 0;
        feature = SerializerFeature.config(feature, SerializerFeature.BrowserSecure, true);
        Assert.assertEquals(true, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserSecure));
        feature = SerializerFeature.config(feature, SerializerFeature.BrowserSecure, false);
        Assert.assertEquals(false, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserSecure));

            

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

                      Assert.assertEquals(false, SerializerFeature.isEnabled(feature, SerializerFeature.BrowserSecure));
    }

    public void test_assert_cnt() throws Exception {
        int len = SerializerFeature.values().length;
        assertTrue(len <= 32);
    }
}

            

Reported by PMD.

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

Line: 27

                  }

    public void test_assert_cnt() throws Exception {
        int len = SerializerFeature.values().length;
        assertTrue(len <= 32);
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

              
    public void test_assert_cnt() throws Exception {
        int len = SerializerFeature.values().length;
        assertTrue(len <= 32);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/fieldbase/FieldBaseTest0.java
5 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

              public class FieldBaseTest0 extends TestCase {
    private static SerializeConfig config = new SerializeConfig(true);
    private static ParserConfig parserConfig = new ParserConfig(true);
    public void test_0() throws Exception {


        Model model = new Model();
        model.id = 123;
        assertEquals("{\"id\":123}", JSON.toJSONString(model, config));

            

Reported by PMD.

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

Line: 14

              public class FieldBaseTest0 extends TestCase {
    private static SerializeConfig config = new SerializeConfig(true);
    private static ParserConfig parserConfig = new ParserConfig(true);
    public void test_0() throws Exception {


        Model model = new Model();
        model.id = 123;
        assertEquals("{\"id\":123}", JSON.toJSONString(model, config));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

              
        Model model = new Model();
        model.id = 123;
        assertEquals("{\"id\":123}", JSON.toJSONString(model, config));

        Model model2 = JSON.parseObject("{\"id\":123}", Model.class, parserConfig);
        assertEquals(model.id, model2.id);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      assertEquals("{\"id\":123}", JSON.toJSONString(model, config));

        Model model2 = JSON.parseObject("{\"id\":123}", Model.class, parserConfig);
        assertEquals(model.id, model2.id);
    }

    public static class Model {
        private int id;
    }

            

Reported by PMD.

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

Line: 26

                  }

    public static class Model {
        private int id;
    }
}

            

Reported by PMD.