The following issues were found

src/test/java/com/alibaba/json/bvt/parser/deser/DefaultObjectDeserializerTest_collection.java
14 issues
Avoid throwing raw exception types.
Design

Line: 54

              	public static class MyMap<K, V> extends HashMap {

		public MyMap() {
			throw new RuntimeException();
		}

	}
}

            

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

              
public class DefaultObjectDeserializerTest_collection extends TestCase {

	public void test_0() throws Exception {
		String input = "[{}]";

		List<HashMap> map = JSON.parseObject(input,
				new TypeReference<List<HashMap>>() {
				}.getType());

            

Reported by PMD.

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

Line: 21

              				new TypeReference<List<HashMap>>() {
				}.getType());

		Assert.assertEquals(HashMap.class, map.get(0).getClass());
	}

	public void test_1() throws Exception {
		String input = "{}";


            

Reported by PMD.

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

Line: 21

              				new TypeReference<List<HashMap>>() {
				}.getType());

		Assert.assertEquals(HashMap.class, map.get(0).getClass());
	}

	public void test_1() throws Exception {
		String input = "{}";


            

Reported by PMD.

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

Line: 24

              		Assert.assertEquals(HashMap.class, map.get(0).getClass());
	}

	public void test_1() throws Exception {
		String input = "{}";

		BO<HashMap> map = JSON.parseObject(input,
				new TypeReference<BO<HashMap>>() {
				}.getType());

            

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

              		Assert.assertEquals(HashMap.class, map.get(0).getClass());
	}

	public void test_1() throws Exception {
		String input = "{}";

		BO<HashMap> map = JSON.parseObject(input,
				new TypeReference<BO<HashMap>>() {
				}.getType());

            

Reported by PMD.

Avoid unused local variables such as 'map'.
Design

Line: 27

              	public void test_1() throws Exception {
		String input = "{}";

		BO<HashMap> map = JSON.parseObject(input,
				new TypeReference<BO<HashMap>>() {
				}.getType());
	}

	public void test_2() 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: 32

              				}.getType());
	}

	public void test_2() throws Exception {

		Exception error = null;
		try {
			String input = "{'map':{}}";


            

Reported by PMD.

Avoid unused local variables such as 'map'.
Design

Line: 38

              		try {
			String input = "{'map':{}}";

			MyMap<String, HashMap> map = JSON.parseObject(input,
					new TypeReference<MyMap<String, HashMap>>() {
					}.getType());
		} catch (Exception ex) {
			error = ex;
		}

            

Reported by PMD.

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

Line: 41

              			MyMap<String, HashMap> map = JSON.parseObject(input,
					new TypeReference<MyMap<String, HashMap>>() {
					}.getType());
		} catch (Exception ex) {
			error = ex;
		}
		Assert.assertNotNull(error);
	}


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONLexerTest_set.java
14 issues
JUnit tests should include assert() or fail()
Design

Line: 11

              
public class JSONLexerTest_set extends TestCase {

    public void test_treeSet() throws Exception {
        JSON.parse("Set[]");
    }

    public void test_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: 11

              
public class JSONLexerTest_set extends TestCase {

    public void test_treeSet() throws Exception {
        JSON.parse("Set[]");
    }

    public void test_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: 15

                      JSON.parse("Set[]");
    }

    public void test_error() throws Exception {
        Exception error = null;
        try {
            JSON.parse("S_t[]");
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

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

Line: 19

                      Exception error = null;
        try {
            JSON.parse("S_t[]");
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
   

            

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

                      Assert.assertNotNull(error);
    }
   
    public void test_error_1() throws Exception {
        Exception error = null;
        try {
            JSON.parse("Se_[]");
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

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

Line: 29

                      Exception error = null;
        try {
            JSON.parse("Se_[]");
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
    

            

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

                  }
    
    
    public void test_error_2() throws Exception {
        Exception error = null;
        try {
            JSON.parse("Set_[]");
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

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

Line: 40

                      Exception error = null;
        try {
            JSON.parse("Set_[]");
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
    

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_error_3() throws Exception {
        Exception error = null;
        try {
            JSON.parse("Xet[]");
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

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

Line: 50

                      Exception error = null;
        try {
            JSON.parse("Xet[]");
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/ConcurrentHashMapTest7.java
14 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: 18

              
public class ConcurrentHashMapTest7 extends TestCase {

    public void test_concurrentHashmap() throws Exception {
        OffsetSerializeWrapper wrapper = new OffsetSerializeWrapper();
        wrapper.getOffsetTable().put(new MessageQueue(), new SoftReference<A>(new A(true)));
        String text = JSON.toJSONString(wrapper);
        Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);


            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);

        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);

        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());

            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 30

                      Iterator<Map.Entry<MessageQueue, SoftReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, SoftReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {

        private ConcurrentHashMap<MessageQueue, SoftReference<A>> offsetTable = new ConcurrentHashMap<MessageQueue, SoftReference<A>>();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue869.java
14 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

               * Created by wenshao on 2016/10/19.
 */
public class Issue869 extends TestCase {
    public void test_for_issue() throws Exception {
        List<DoublePoint> doublePointList = new ArrayList<DoublePoint>();
        {
            DoublePoint doublePoint = new DoublePoint();
            doublePoint.startPoint = new Point(22, 35);
            doublePoint.endPoint = doublePoint.startPoint;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 31

                      }

        String json = JSON.toJSONString(doublePointList);
        assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";

            

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

                      assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));

            

Reported by PMD.

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

Line: 34

                      assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"x\":22,\"y\":35}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"x\":16,\"y\":18}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

              
        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                      String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static  class DoublePoint{

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                      List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static  class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

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

Line: 40

                      List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static  class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

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

Line: 40

                      List<DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static  class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                      assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static  class DoublePoint{
        public Point startPoint;
        public Point endPoint;

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/serializer/SerializeWriterTest.java
14 issues
The Logger variable declaration does not contain the static and final modifiers
Error

Line: 19

              
public class SerializeWriterTest {

    private final Logger logger = Logger.getLogger(SerializeWriterTest.class.getSimpleName());

    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();

    private final SerializeWriter writer = new SerializeWriter(new OutputStreamWriter(baos));


            

Reported by PMD.

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

Line: 19

              
public class SerializeWriterTest {

    private final Logger logger = Logger.getLogger(SerializeWriterTest.class.getSimpleName());

    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();

    private final SerializeWriter writer = new SerializeWriter(new OutputStreamWriter(baos));


            

Reported by PMD.

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

Line: 21

              
    private final Logger logger = Logger.getLogger(SerializeWriterTest.class.getSimpleName());

    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();

    private final SerializeWriter writer = new SerializeWriter(new OutputStreamWriter(baos));

    @Before
    public void setUp() throws Exception {

            

Reported by PMD.

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

Line: 23

              
    private final ByteArrayOutputStream baos = new ByteArrayOutputStream();

    private final SerializeWriter writer = new SerializeWriter(new OutputStreamWriter(baos));

    @Before
    public void setUp() throws Exception {
    }


            

Reported by PMD.

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

Line: 34

                  }

    @Test
    public void testWriteLiteBasicStr() throws UnsupportedEncodingException {
        String targetStr = new String(IOUtils.DIGITS);
        this.doTestWrite(targetStr);
    }

    private String doTestWrite(String input) throws UnsupportedEncodingException {

            

Reported by PMD.

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

Line: 52

                  }

    @Test
    public void testWriteLiteSpecilaStr() throws UnsupportedEncodingException {
        this.doTestWrite(this.makeSpecialChars());
    }

    private String makeSpecialChars() {
        StringBuilder strBuilder = new StringBuilder(128);

            

Reported by PMD.

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

Line: 65

                  }

    @Test
    public void testWriteLargeBasicStr() throws UnsupportedEncodingException {
        String str = createLargeBasicStr();
        this.doTestWrite(str);
    }

    private String createLargeBasicStr() {

            

Reported by PMD.

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

Line: 80

                  }

    @Test
    public void testWriteLargeSpecialStr() throws UnsupportedEncodingException {

        String tmp = this.makeSpecialChars();
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 200; i++) {
            builder.append(tmp);

            

Reported by PMD.

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

Line: 91

                  }

    @Test
    public void test_large() throws Exception {
        SerializeWriter writer = new SerializeWriter();

        for (int i = 0; i < 1024 * 1024; ++i) {
            writer.write(i);
        }

            

Reported by PMD.

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

Line: 113

              
        //检查bytesLocal大小,如果缓存成功应该大于等于输出的bytes长度
        Field bytesBufLocalField = SerializeWriter.class.getDeclaredField("bytesBufLocal");
        bytesBufLocalField.setAccessible(true);
        ThreadLocal<byte[]> bytesBufLocal = (ThreadLocal<byte[]>) bytesBufLocalField.get(null);
        byte[] bytesLocal = bytesBufLocal.get();
        Assert.assertNotNull("bytesLocal is null", bytesLocal);
        Assert.assertTrue("bytesLocal is smaller than expected", bytesLocal.length >= bytes.length);
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/AbstractSerializeTest2.java
14 issues
JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 13

              
public class AbstractSerializeTest2 extends TestCase {

    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.AbstractSerializeTest2");
        ParserConfig.global.addAccept("com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2");
    }

    protected void tearDown() throws Exception {

            

Reported by PMD.

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

Line: 14

              public class AbstractSerializeTest2 extends TestCase {

    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.AbstractSerializeTest2");
        ParserConfig.global.addAccept("com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2");
    }

    protected void tearDown() throws Exception {
        ParserConfig.getGlobalInstance().putDeserializer(A.class, null);

            

Reported by PMD.

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

Line: 15

              
    protected void setUp() throws Exception {
        ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.AbstractSerializeTest2");
        ParserConfig.global.addAccept("com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2");
    }

    protected void tearDown() throws Exception {
        ParserConfig.getGlobalInstance().putDeserializer(A.class, null);
    }

            

Reported by PMD.

JUnit 4 tests that clean up tests should use the @After annotation, JUnit5 tests should use @AfterEach or @AfterAll
Design

Line: 18

                      ParserConfig.global.addAccept("com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2");
    }

    protected void tearDown() throws Exception {
        ParserConfig.getGlobalInstance().putDeserializer(A.class, null);
    }

    public void test_mapping_0() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$A\"}";

            

Reported by PMD.

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

Line: 19

                  }

    protected void tearDown() throws Exception {
        ParserConfig.getGlobalInstance().putDeserializer(A.class, null);
    }

    public void test_mapping_0() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$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: 22

                      ParserConfig.getGlobalInstance().putDeserializer(A.class, null);
    }

    public void test_mapping_0() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$A\"}";

        B b = (B) JSON.parse(text);
        Assert.assertNotNull(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: 29

                      Assert.assertNotNull(b);
    }

    public void test_mapping_1() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$A\",\"id\":123}";

        B b = (B) JSON.parse(text);
        Assert.assertNotNull(b);
        Assert.assertEquals(123, b.getId());

            

Reported by PMD.

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

Line: 34

              
        B b = (B) JSON.parse(text);
        Assert.assertNotNull(b);
        Assert.assertEquals(123, b.getId());
    }

    public void test_mapping_2() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$A\",\"id\":234,\"name\":\"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: 37

                      Assert.assertEquals(123, b.getId());
    }

    public void test_mapping_2() throws Exception {
        String text = "{\"@type\":\"com.alibaba.json.bvt.parser.deser.AbstractSerializeTest2$A\",\"id\":234,\"name\":\"abc\"}";

        B b = (B) JSON.parse(text);
        Assert.assertNotNull(b);
        Assert.assertEquals(234, b.getId());

            

Reported by PMD.

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

Line: 42

              
        B b = (B) JSON.parse(text);
        Assert.assertNotNull(b);
        Assert.assertEquals(234, b.getId());
        Assert.assertEquals("abc", b.getName());
    }

    public void test_mapping_group() throws Exception {
        String text = "{\"a\":{\"id\":234,\"name\":\"abc\"}}";

            

Reported by PMD.

src/test/java/com/alibaba/json/test/InnerInnerTest.java
14 issues
The class 'Outter' is suspected to be a Data Class (WOC=0.000%, NOPA=0, NOAM=4, WMC=4)
Design

Line: 10

              
import junit.framework.TestCase;

class Outter{
	private String name;
	private InnerInner ii;
	
	public String getName() {
		return name;

            

Reported by PMD.

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

Line: 50

              
public class InnerInnerTest extends TestCase{//深层内部类的序列化反序列化测试

	public void testDeserialize(){//
		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}

            

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

              
public class InnerInnerTest extends TestCase{//深层内部类的序列化反序列化测试

	public void testDeserialize(){//
		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}

            

Reported by PMD.

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

Line: 53

              	public void testDeserialize(){//
		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();

            

Reported by PMD.

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

Line: 53

              	public void testDeserialize(){//
		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();

            

Reported by PMD.

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

Line: 54

              		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();
		Inner i = o.new Inner();

            

Reported by PMD.

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

Line: 54

              		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();
		Inner i = o.new Inner();

            

Reported by PMD.

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

Line: 54

              		String json = "{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}";
		Outter o = JSON.parseObject(json, Outter.class);
		assertEquals("ocls", o.getName());
		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();
		Inner i = o.new Inner();

            

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

              		assertEquals("iicls", o.getIi().getName());
	}
	
	public void testSerialize(){
		Outter o = new Outter();
		Inner i = o.new Inner();
		InnerInner ii = i.new InnerInner();
		ii.setName("iicls");
		o.setIi(ii);

            

Reported by PMD.

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

Line: 68

              		assertEquals("{\"ii\":{\"name\":\"iicls\"},\"name\":\"ocls\"}", json);
	}
	
	public void testGson(){
		Outter o = new Outter();
		Inner i = o.new Inner();
		InnerInner ii = i.new InnerInner();
		ii.setName("iicls");
		o.setIi(ii);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/asm/ASMDeserTest.java
14 issues
Avoid throwing raw exception types.
Design

Line: 67

                  public static class EntityError extends ArrayList<String> {

        public EntityError(){
            throw new RuntimeException();
        }
    }
}

            

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 ASMDeserTest extends TestCase {

    public void test_codec() throws Exception {
        String text = JSON.toJSONString(new Entity());

        Assert.assertEquals("[]", text);

        Entity object = JSON.parseObject(text, Entity.class);

            

Reported by PMD.

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

Line: 18

                      Assert.assertEquals("[]", text);

        Entity object = JSON.parseObject(text, Entity.class);
        Assert.assertEquals(0, object.size());
    }
    
    public void test_codec_1() throws Exception {
        String text = JSON.toJSONString(new VO());


            

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(0, object.size());
    }
    
    public void test_codec_1() throws Exception {
        String text = JSON.toJSONString(new VO());

        Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);
        Assert.assertEquals(0, object.getValue().size());
    }

    public void test_ArrayList() throws Exception {

        ArrayList object = JSON.parseObject("[]", ArrayList.class);

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals("{\"value\":[]}", text);

        VO object = JSON.parseObject(text, VO.class);
        Assert.assertEquals(0, object.getValue().size());
    }

    public void test_ArrayList() throws Exception {

        ArrayList object = JSON.parseObject("[]", ArrayList.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: 30

                      Assert.assertEquals(0, object.getValue().size());
    }

    public void test_ArrayList() throws Exception {

        ArrayList object = JSON.parseObject("[]", ArrayList.class);
        Assert.assertEquals(0, object.size());
    }


            

Reported by PMD.

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

Line: 32

              
    public void test_ArrayList() throws Exception {

        ArrayList object = JSON.parseObject("[]", ArrayList.class);
        Assert.assertEquals(0, object.size());
    }

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

            

Reported by PMD.

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

Line: 33

                  public void test_ArrayList() throws Exception {

        ArrayList object = JSON.parseObject("[]", ArrayList.class);
        Assert.assertEquals(0, object.size());
    }

    public void test_error() throws Exception {
        Exception error = null;
        try {

            

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

                      Assert.assertEquals(0, object.size());
    }

    public void test_error() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("[]", EntityError.class);
        } catch (Exception ex) {
            error = ex;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/ConcurrentHashMapTest4.java
14 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: 18

              
public class ConcurrentHashMapTest4 extends TestCase {

    public void test_concurrentHashmap() throws Exception {
        OffsetSerializeWrapper wrapper = new OffsetSerializeWrapper();
        wrapper.getOffsetTable().put(new MessageQueue(), new AtomicReference<A>(new A(true)));
        String text = JSON.toJSONString(wrapper);
        Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);


            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);

        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:{\"value\":true}}}", text);

        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());

            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 27

                      OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());

        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

              
        Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 30

                      Iterator<Map.Entry<MessageQueue, AtomicReference<A>>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicReference<A>> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get().isValue());
    }

    public static class OffsetSerializeWrapper {

        private ConcurrentHashMap<MessageQueue, AtomicReference<A>> offsetTable = new ConcurrentHashMap<MessageQueue, AtomicReference<A>>();

            

Reported by PMD.

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

    public void test_null() throws Exception {
        Assert.assertNull(JSON.parseObject("null", Object[].class));
        Assert.assertNull(JSON.parseObject("null", String[].class));
        Assert.assertNull(JSON.parseObject("null", VO[].class));
        Assert.assertNull(JSON.parseObject("null", VO[][].class));
    }

            

Reported by PMD.

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

Line: 11

              public class ArrayDeserializerTest extends TestCase {

    public void test_null() throws Exception {
        Assert.assertNull(JSON.parseObject("null", Object[].class));
        Assert.assertNull(JSON.parseObject("null", String[].class));
        Assert.assertNull(JSON.parseObject("null", VO[].class));
        Assert.assertNull(JSON.parseObject("null", VO[][].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: 17

                      Assert.assertNull(JSON.parseObject("null", VO[][].class));
    }

    public void test_0() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("[]", Object[].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);

            

Reported by PMD.

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

Line: 18

                  }

    public void test_0() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("[]", Object[].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);

            

Reported by PMD.

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

Line: 19

              
    public void test_0() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("[]", Object[].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);

            

Reported by PMD.

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

Line: 20

                  public void test_0() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("[]", Object[].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);
        Assert.assertEquals(null, JSON.parseObject("{\"value\":null}", VO.class).getValue());

            

Reported by PMD.

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

Line: 21

                      Assert.assertEquals(0, JSON.parseObject("[]", Object[].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);
        Assert.assertEquals(null, JSON.parseObject("{\"value\":null}", VO.class).getValue());
    }

            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals(0, JSON.parseObject("[]", Object[][].class).length);
        Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);
        Assert.assertEquals(null, JSON.parseObject("{\"value\":null}", VO.class).getValue());
    }


            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(0, JSON.parseObject("[]", Object[][][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);
        Assert.assertEquals(null, JSON.parseObject("{\"value\":null}", VO.class).getValue());
    }

    public static class VO {

            

Reported by PMD.

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

Line: 24

                      Assert.assertEquals(1, JSON.parseObject("[null]", Object[].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[[[[[[]]]]]]", Object[][].class).length);
        Assert.assertEquals(1, JSON.parseObject("[null]", Object[][][].class).length);
        Assert.assertEquals(null, JSON.parseObject("{\"value\":null}", VO.class).getValue());
    }

    public static class VO {


            

Reported by PMD.