The following issues were found

src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_List.java
8 issues
System.out.println is used
Design

Line: 22

                      A a = new A();
        a.setList(Collections.singletonList(new B()));
        String text = JSON.toJSONString(a, SerializerFeature.WriteClassName);
        System.out.println(text);
        Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List$A\",\"list\":[{}]}",
                            text);

        A a1 = (A) JSON.parse(text);


            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 14

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class WriteClassNameTest_List extends TestCase {
    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List");
    }

    public void test_list() throws Exception {
        A a = new A();

            

Reported by PMD.

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

Line: 15

              
public class WriteClassNameTest_List extends TestCase {
    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List");
    }

    public void test_list() throws Exception {
        A a = new A();
        a.setList(Collections.singletonList(new B()));

            

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

                      ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List");
    }

    public void test_list() throws Exception {
        A a = new A();
        a.setList(Collections.singletonList(new B()));
        String text = JSON.toJSONString(a, SerializerFeature.WriteClassName);
        System.out.println(text);
        Assert.assertEquals("{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List$A\",\"list\":[{}]}",

            

Reported by PMD.

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

Line: 28

              
        A a1 = (A) JSON.parse(text);

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().get(0) instanceof B);
    }

    private static class A {


            

Reported by PMD.

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

Line: 28

              
        A a1 = (A) JSON.parse(text);

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().get(0) instanceof B);
    }

    private static class A {


            

Reported by PMD.

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

Line: 29

                      A a1 = (A) JSON.parse(text);

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().get(0) instanceof B);
    }

    private static class A {

        private List<B> list;

            

Reported by PMD.

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

Line: 29

                      A a1 = (A) JSON.parse(text);

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().get(0) instanceof B);
    }

    private static class A {

        private List<B> list;

            

Reported by PMD.

src/test/java/com/alibaba/json/test/codec/Codec.java
8 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 10

              
    String getName();

    <T> T decodeObject(String text, Class<T> clazz) throws Exception;

    <T> T decodeObject(byte[] input, Class<T> clazz) throws Exception;

    <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception;


            

Reported by PMD.

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

Line: 12

              
    <T> T decodeObject(String text, Class<T> clazz) throws Exception;

    <T> T decodeObject(byte[] input, Class<T> clazz) throws Exception;

    <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception;

    Object decodeObject(String text) throws Exception;


            

Reported by PMD.

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

Line: 14

              
    <T> T decodeObject(byte[] input, Class<T> clazz) throws Exception;

    <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception;

    Object decodeObject(String text) throws Exception;

    Object decode(String text) throws Exception;
    

            

Reported by PMD.

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

Line: 16

              
    <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception;

    Object decodeObject(String text) throws Exception;

    Object decode(String text) throws Exception;
    
    void encode(OutputStream out, Object object) throws Exception;


            

Reported by PMD.

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

Line: 18

              
    Object decodeObject(String text) throws Exception;

    Object decode(String text) throws Exception;
    
    void encode(OutputStream out, Object object) throws Exception;

    String encode(Object object) throws Exception;
    

            

Reported by PMD.

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

Line: 20

              
    Object decode(String text) throws Exception;
    
    void encode(OutputStream out, Object object) throws Exception;

    String encode(Object object) throws Exception;
    
    byte[] encodeToBytes(Object object) throws Exception;
}

            

Reported by PMD.

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

Line: 22

                  
    void encode(OutputStream out, Object object) throws Exception;

    String encode(Object object) throws Exception;
    
    byte[] encodeToBytes(Object object) throws Exception;
}

            

Reported by PMD.

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

Line: 24

              
    String encode(Object object) throws Exception;
    
    byte[] encodeToBytes(Object object) throws Exception;
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/util/Base64Test.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 7

              import junit.framework.TestCase;

public class Base64Test extends TestCase {
    public void test_base64() throws Exception {
        String str = "阿里巴巴網絡有限公司主要通過旗下三個交易市場協助世界各地數以百萬計的買家和供應商從事網上生意,包括:集中服務全球進出口商的國際交易市場(www.alibaba.com);集中國內貿易的中國交易市場(www.1688.com);以及在國際交易市場上的全球批發交易平台(www.aliexpress.com),為規模較小、需要小批量貨物快速付運的買家提供服務。更多>>";

        byte[] bytes = str.getBytes("UTF8");
        String base64Str = com.alibaba.json.test.Base64.encodeToString(bytes, 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: 7

              import junit.framework.TestCase;

public class Base64Test extends TestCase {
    public void test_base64() throws Exception {
        String str = "阿里巴巴網絡有限公司主要通過旗下三個交易市場協助世界各地數以百萬計的買家和供應商從事網上生意,包括:集中服務全球進出口商的國際交易市場(www.alibaba.com);集中國內貿易的中國交易市場(www.1688.com);以及在國際交易市場上的全球批發交易平台(www.aliexpress.com),為規模較小、需要小批量貨物快速付運的買家提供服務。更多>>";

        byte[] bytes = str.getBytes("UTF8");
        String base64Str = com.alibaba.json.test.Base64.encodeToString(bytes, false);


            

Reported by PMD.

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

Line: 10

                  public void test_base64() throws Exception {
        String str = "阿里巴巴網絡有限公司主要通過旗下三個交易市場協助世界各地數以百萬計的買家和供應商從事網上生意,包括:集中服務全球進出口商的國際交易市場(www.alibaba.com);集中國內貿易的中國交易市場(www.1688.com);以及在國際交易市場上的全球批發交易平台(www.aliexpress.com),為規模較小、需要小批量貨物快速付運的買家提供服務。更多>>";

        byte[] bytes = str.getBytes("UTF8");
        String base64Str = com.alibaba.json.test.Base64.encodeToString(bytes, false);

        {
            byte[] bytes2 = Base64.decodeFast(base64Str);
            assertEquals(str, new String(bytes2, "UTF8"));

            

Reported by PMD.

The String literal 'UTF8' appears 4 times in this file; the first occurrence is on line 10
Error

Line: 10

                  public void test_base64() throws Exception {
        String str = "阿里巴巴網絡有限公司主要通過旗下三個交易市場協助世界各地數以百萬計的買家和供應商從事網上生意,包括:集中服務全球進出口商的國際交易市場(www.alibaba.com);集中國內貿易的中國交易市場(www.1688.com);以及在國際交易市場上的全球批發交易平台(www.aliexpress.com),為規模較小、需要小批量貨物快速付運的買家提供服務。更多>>";

        byte[] bytes = str.getBytes("UTF8");
        String base64Str = com.alibaba.json.test.Base64.encodeToString(bytes, false);

        {
            byte[] bytes2 = Base64.decodeFast(base64Str);
            assertEquals(str, new String(bytes2, "UTF8"));

            

Reported by PMD.

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

Line: 11

                      String str = "阿里巴巴網絡有限公司主要通過旗下三個交易市場協助世界各地數以百萬計的買家和供應商從事網上生意,包括:集中服務全球進出口商的國際交易市場(www.alibaba.com);集中國內貿易的中國交易市場(www.1688.com);以及在國際交易市場上的全球批發交易平台(www.aliexpress.com),為規模較小、需要小批量貨物快速付運的買家提供服務。更多>>";

        byte[] bytes = str.getBytes("UTF8");
        String base64Str = com.alibaba.json.test.Base64.encodeToString(bytes, false);

        {
            byte[] bytes2 = Base64.decodeFast(base64Str);
            assertEquals(str, new String(bytes2, "UTF8"));
        }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

              
        {
            byte[] bytes2 = Base64.decodeFast(base64Str);
            assertEquals(str, new String(bytes2, "UTF8"));
        }

        {
            byte[] bytes2 = Base64.decodeFast(base64Str, 0, base64Str.length());
            assertEquals(str, new String(bytes2, "UTF8"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        {
            byte[] bytes2 = Base64.decodeFast(base64Str, 0, base64Str.length());
            assertEquals(str, new String(bytes2, "UTF8"));
        }

        {
            byte[] bytes2 = Base64.decodeFast(base64Str.toCharArray(), 0, base64Str.length());
            assertEquals(str, new String(bytes2, "UTF8"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

              
        {
            byte[] bytes2 = Base64.decodeFast(base64Str.toCharArray(), 0, base64Str.length());
            assertEquals(str, new String(bytes2, "UTF8"));
        }
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArrayTest2.java
8 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

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest2 extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest2 extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldFloatArrayTest2 extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);
        assertEquals(3.0f, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);
        assertEquals(3.0f, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);
        assertEquals(3.0f, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);
        assertEquals(3.0f, model.value[2]);
    }

    public static class Model {
        public float[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1.0f, model.value[0]);
        assertEquals(0.0f, model.value[1]);
        assertEquals(3.0f, model.value[2]);
    }

    public static class Model {
        public float[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public float[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArrayTest.java
8 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

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldFloatArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldFloatArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,2.1,-0.3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    public static class Model {
        public float[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1f, model.value[0]);
        assertEquals(2.1f, model.value[1]);
        assertEquals(-0.3f, model.value[2]);
    }

    public static class Model {
        public float[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public float[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_1.java
8 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

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class SerializeWriterTest_1 extends TestCase {
    public void test_0 () throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.UseSingleQuotes);
        out.writeString("abc");
        Assert.assertEquals("'abc'", out.toString());
    }
    

            

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("'abc'", out.toString());
    }
    
    public void test_1 () throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.UseSingleQuotes);
        out.writeString("abc中文");
        
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        out.writeTo(byteOut, "UTF-8");

            

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

                      Assert.assertEquals("'abc中文'", new String(byteOut.toByteArray(), "UTF-8"));
    }
    
    public void test_2 () throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.UseSingleQuotes);
        out.writeString("abc");
        Assert.assertEquals("'abc'", new String(out.toBytes((String) null), "ISO-8859-1"));
    }
    

            

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

                      Assert.assertEquals("'abc'", new String(out.toBytes((String) null), "ISO-8859-1"));
    }
    
    public void test_3 () throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.UseSingleQuotes);
        out.writeString("abc");
        Assert.assertEquals("'abc'", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    

            

Reported by PMD.

The String literal 'UTF-16' appears 8 times in this file; the first occurrence is on line 36
Error

Line: 36

                  public void test_3 () throws Exception {
        SerializeWriter out = new SerializeWriter(SerializerFeature.UseSingleQuotes);
        out.writeString("abc");
        Assert.assertEquals("'abc'", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    
    public void test_5 () throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.write((String) 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: 39

                      Assert.assertEquals("'abc'", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    
    public void test_5 () throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.write((String) null);
        Assert.assertEquals("null", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    

            

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

                      Assert.assertEquals("null", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    
    public void test_6 () throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeString("中文");
        Assert.assertEquals("\"中文\"", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    

            

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

                      Assert.assertEquals("\"中文\"", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
    
    public void test_null () throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.writeString((String) null);
        Assert.assertEquals("null", new String(out.toBytes("UTF-16"), "UTF-16"));
    }
}

            

Reported by PMD.

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

    public void test_byte() throws Exception {
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("\"123\"", byte.class));
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("\"123\"", Byte.class));
    }

    public void test_byte1() throws Exception {

            

Reported by PMD.

The String literal '\'123\'' appears 4 times in this file; the first occurrence is on line 12
Error

Line: 12

              public class NumberDeserializerTest extends TestCase {

    public void test_byte() throws Exception {
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("\"123\"", byte.class));
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("\"123\"", Byte.class));
    }

    public void test_byte1() throws Exception {
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", byte.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: 16

                      Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("\"123\"", Byte.class));
    }

    public void test_byte1() throws Exception {
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", byte.class));
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", Byte.class));
    }

    public void test_short() throws Exception {

            

Reported by PMD.

The String literal '123.' appears 6 times in this file; the first occurrence is on line 17
Error

Line: 17

                  }

    public void test_byte1() throws Exception {
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", byte.class));
        Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", Byte.class));
    }

    public void test_short() throws Exception {
        Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("\"123\"", short.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: 21

                      Assert.assertEquals(Byte.valueOf((byte) 123), JSON.parseObject("123.", Byte.class));
    }

    public void test_short() throws Exception {
        Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("\"123\"", short.class));
        Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("\"123\"", Short.class));
    }

    public void test_short1() throws Exception {

            

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(Short.valueOf((short) 123), JSON.parseObject("\"123\"", Short.class));
    }

    public void test_short1() throws Exception {
        Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("123.", short.class));
        Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("123.", Short.class));
    }

    public void test_double() throws Exception {

            

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

                      Assert.assertEquals(Short.valueOf((short) 123), JSON.parseObject("123.", Short.class));
    }

    public void test_double() throws Exception {
        Assert.assertTrue(123.0D == JSON.parseObject("123.", double.class));
        Assert.assertTrue(123.0D == JSON.parseObject("123.", Double.class).doubleValue());
    }
}

            

Reported by PMD.

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

Line: 33

              
    public void test_double() throws Exception {
        Assert.assertTrue(123.0D == JSON.parseObject("123.", double.class));
        Assert.assertTrue(123.0D == JSON.parseObject("123.", Double.class).doubleValue());
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldByteArrayTest.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldByteArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

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 11/01/2017.
 */
public class FieldByteArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldByteArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public byte[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public byte[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public byte[] value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/JSONPath_10_contains.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 13

              
public class JSONPath_10_contains extends TestCase {

    public void test(){
        String json = "{\n" +
                "    \"queryScene\":{\n" +
                "        \"scene\":[\n" +
                "            {\n" +
                "                \"innerSceneId\":3,\n" +

            

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

              
public class JSONPath_10_contains extends TestCase {

    public void test(){
        String json = "{\n" +
                "    \"queryScene\":{\n" +
                "        \"scene\":[\n" +
                "            {\n" +
                "                \"innerSceneId\":3,\n" +

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 54

                              "        ]\n" +
                "    }\n" +
                "}";
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet"));
        assertFalse(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.abcd"));
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.name"));
    }

//    public void test_path_2() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 55

                              "    }\n" +
                "}";
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet"));
        assertFalse(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.abcd"));
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.name"));
    }

//    public void test_path_2() throws Exception {
////        File file = new File("/Users/wenshao/Downloads/test");

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 56

                              "}";
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet"));
        assertFalse(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.abcd"));
        assertTrue(JSONPath.contains(JSON.parseObject(json), "$.queryScene.scene.queryDataSet.dataSet.name"));
    }

//    public void test_path_2() throws Exception {
////        File file = new File("/Users/wenshao/Downloads/test");
////        String json = FileUtils.readFileToString(file);

            

Reported by PMD.

Avoid unused imports such as 'java.util.HashMap'
Design

Line: 7

              import com.alibaba.fastjson.JSONPath;
import junit.framework.TestCase;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class JSONPath_10_contains extends TestCase {


            

Reported by PMD.

Avoid unused imports such as 'java.util.Map'
Design

Line: 8

              import junit.framework.TestCase;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class JSONPath_10_contains extends TestCase {

    public void test(){

            

Reported by PMD.

Avoid unused imports such as 'java.util.concurrent.TimeUnit'
Design

Line: 9

              
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class JSONPath_10_contains extends TestCase {

    public void test(){
        String json = "{\n" +

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/date/DateTest_ISO8601_TwoLetterISO8601TimeZone.java
8 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 13

              
public class DateTest_ISO8601_TwoLetterISO8601TimeZone extends TestCase {

    public void f_test_date() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.2+0800\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        

            

Reported by PMD.

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

Line: 16

                  public void f_test_date() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.2+0800\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    

            

Reported by PMD.

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

Line: 19

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+0900\"}";
        

            

Reported by PMD.

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

Line: 19

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+0900\"}";
        

            

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

                      Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+0900\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        

            

Reported by PMD.

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

Line: 25

                  public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+0900\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }


            

Reported by PMD.

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

Line: 28

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }

    public static class VO {

        private Calendar gmtCreate;

            

Reported by PMD.

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

Line: 28

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }

    public static class VO {

        private Calendar gmtCreate;

            

Reported by PMD.