The following issues were found

src/test/java/com/alibaba/json/bvt/geo/FeatureTest.java
13 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 FeatureTest
        extends TestCase {
    public void test_geo() throws Exception {
        String str = "{\n" +
                "    \"type\": \"Feature\",\n" +
                "    \"bbox\": [-10.0, -10.0, 10.0, 10.0],\n" +
                "    \"geometry\": {\n" +
                "       \"type\": \"Polygon\",\n" +

            

Reported by PMD.

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

Line: 11

              
public class FeatureTest
        extends TestCase {
    public void test_geo() throws Exception {
        String str = "{\n" +
                "    \"type\": \"Feature\",\n" +
                "    \"bbox\": [-10.0, -10.0, 10.0, 10.0],\n" +
                "    \"geometry\": {\n" +
                "       \"type\": \"Polygon\",\n" +

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 29

                              "}";

        Geometry geometry = JSON.parseObject(str, Geometry.class);
        assertEquals(Feature.class, geometry.getClass());

        assertEquals("{\"type\":\"Feature\",\"bbox\":[-10.0,-10.0,10.0,10.0],\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));

            

Reported by PMD.

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

Line: 29

                              "}";

        Geometry geometry = JSON.parseObject(str, Geometry.class);
        assertEquals(Feature.class, geometry.getClass());

        assertEquals("{\"type\":\"Feature\",\"bbox\":[-10.0,-10.0,10.0,10.0],\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 31

                      Geometry geometry = JSON.parseObject(str, Geometry.class);
        assertEquals(Feature.class, geometry.getClass());

        assertEquals("{\"type\":\"Feature\",\"bbox\":[-10.0,-10.0,10.0,10.0],\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

                      assertEquals("{\"type\":\"Feature\",\"bbox\":[-10.0,-10.0,10.0,10.0],\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));
    }

    public void test_geo_1() throws Exception {
        String str = "{\n" +
                "    \"type\": \"Feature\",\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: 37

                      assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));
    }

    public void test_geo_1() throws Exception {
        String str = "{\n" +
                "    \"type\": \"Feature\",\n" +
                "    \"id\": \"f2\",\n" +
                "    \"geometry\": {\n" +
                "       \"type\": \"Polygon\",\n" +

            

Reported by PMD.

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

Line: 37

                      assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));
    }

    public void test_geo_1() throws Exception {
        String str = "{\n" +
                "    \"type\": \"Feature\",\n" +
                "    \"id\": \"f2\",\n" +
                "    \"geometry\": {\n" +
                "       \"type\": \"Polygon\",\n" +

            

Reported by PMD.

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

Line: 55

                              "}";

        Geometry geometry = JSON.parseObject(str, Geometry.class);
        assertEquals(Feature.class, geometry.getClass());

        assertEquals("{\"type\":\"Feature\",\"id\":\"f2\",\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 55

                              "}";

        Geometry geometry = JSON.parseObject(str, Geometry.class);
        assertEquals(Feature.class, geometry.getClass());

        assertEquals("{\"type\":\"Feature\",\"id\":\"f2\",\"properties\":{},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-10.0,-10.0],[10.0,-10.0],[10.0,10.0],[-10.0,-10.0]]]}}", JSON.toJSONString(geometry));

        String str2 = JSON.toJSONString(geometry);
        assertEquals(str2, JSON.toJSONString(JSON.parseObject(str2, Geometry.class)));

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_ascii_0_31.java
13 issues
The class 'Bug_for_ascii_0_31' has a Standard Cyclomatic Complexity of 21 (Highest = 20).
Design

Line: 9

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class Bug_for_ascii_0_31 extends TestCase {

    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;

            

Reported by PMD.

The method 'test_0()' has a NCSS line count of 71.
Design

Line: 11

              
public class Bug_for_ascii_0_31 extends TestCase {

    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;
            buf.append(ch);


            

Reported by PMD.

The method 'test_0()' has a cyclomatic complexity of 20.
Design

Line: 11

              
public class Bug_for_ascii_0_31 extends TestCase {

    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;
            buf.append(ch);


            

Reported by PMD.

The method 'test_0' has a Standard Cyclomatic Complexity of 20.
Design

Line: 11

              
public class Bug_for_ascii_0_31 extends TestCase {

    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;
            buf.append(ch);


            

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

    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;
            buf.append(ch);


            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 13

              
    public void test_0() throws Exception {
        for (int i = 0; i < 32; ++i) {
            StringBuilder buf = new StringBuilder();
            char ch = (char) i;
            buf.append(ch);

            String text = JSON.toJSONString(buf.toString(), SerializerFeature.BrowserCompatible);


            

Reported by PMD.

Avoid using Literals in Conditional Statements
Error

Line: 45

                                  Assert.assertEquals("\"\\t\"", text);
                    break;
                default:
                    if (i < 16) {
                        Assert.assertEquals("\"\\u000" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    } else {
                        Assert.assertEquals("\"\\u00" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    }
                    break;

            

Reported by PMD.

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

Line: 46

                                  break;
                default:
                    if (i < 16) {
                        Assert.assertEquals("\"\\u000" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    } else {
                        Assert.assertEquals("\"\\u00" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    }
                    break;
            }

            

Reported by PMD.

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

Line: 48

                                  if (i < 16) {
                        Assert.assertEquals("\"\\u000" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    } else {
                        Assert.assertEquals("\"\\u00" + Integer.toHexString(i).toUpperCase() + "\"", text);
                    }
                    break;
            }

            VO vo = new VO();

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 53

                                  break;
            }

            VO vo = new VO();
            vo.setContent(buf.toString());

            String voText = JSON.toJSONString(vo, SerializerFeature.BrowserCompatible);

            switch (ch) {

            

Reported by PMD.

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

              
public class EnumerationSeriliazerTest extends TestCase {

    public void test_nullAsEmtpyList() throws Exception {
        VO e = new VO();
        Assert.assertEquals("{\"elements\":[]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue,
                                                                   SerializerFeature.WriteNullListAsEmpty));
    }


            

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

                                                                                 SerializerFeature.WriteNullListAsEmpty));
    }

    public void test_null() throws Exception {
        VO e = new VO();
        Assert.assertEquals("{\"elements\":null}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
    }

    public void test_1() 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("{\"elements\":null}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
    }

    public void test_1() throws Exception {
        VO e = new VO(new Entity(), new Entity());
        Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
    }

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

                      Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
    }

    public void test_2() throws Exception {
        VO e = new VO(new Entity(), new Entity2());
        Assert.assertEquals("{\"elements\":[{},{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity2\"}]}",
                            JSON.toJSONString(e, SerializerFeature.WriteClassName,
                                              SerializerFeature.NotWriteRootClassName));
    }

            

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

                                                            SerializerFeature.NotWriteRootClassName));
    }

    public void test_3() throws Exception {
        VO2 e = new VO2(new Entity(), new Entity());
        Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteClassName,
                                                                        SerializerFeature.NotWriteRootClassName));
    }
    

            

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

                                                                                      SerializerFeature.NotWriteRootClassName));
    }
    
    public void test_4() throws Exception {
        VO3 e = new VO3(new Entity(), new Entity2());
        Assert.assertEquals("{\"elements\":[{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity\"},{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity2\"}]}", JSON.toJSONString(e, SerializerFeature.WriteClassName,
                                                                        SerializerFeature.NotWriteRootClassName));
    }


            

Reported by PMD.

Consider replacing this Vector with the newer java.util.List
Design

Line: 56

              
        public VO(Entity... array){
            if (array.length > 0) {
                Vector<Entity> vector = new Vector<Entity>();
                for (Entity item : array) {
                    vector.add(item);
                }
                this.elements = vector.elements();
            }

            

Reported by PMD.

Use ArrayList instead of Vector
Performance

Line: 56

              
        public VO(Entity... array){
            if (array.length > 0) {
                Vector<Entity> vector = new Vector<Entity>();
                for (Entity item : array) {
                    vector.add(item);
                }
                this.elements = vector.elements();
            }

            

Reported by PMD.

Use ArrayList instead of Vector
Performance

Line: 78

              
        public VO2(Entity... array){
            if (array.length > 0) {
                Vector<Entity> vector = new Vector<Entity>();
                for (Entity item : array) {
                    vector.add(item);
                }
                this.elements = vector.elements();
            }

            

Reported by PMD.

Consider replacing this Vector with the newer java.util.List
Design

Line: 78

              
        public VO2(Entity... array){
            if (array.length > 0) {
                Vector<Entity> vector = new Vector<Entity>();
                for (Entity item : array) {
                    vector.add(item);
                }
                this.elements = vector.elements();
            }

            

Reported by PMD.

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

              
public class JSONFieldTest_unwrapped_1 extends TestCase {

    public void test_jsonField() throws Exception {
        VO vo = new VO();
        vo.id = 123;
        vo.properties.put("latitude", 37);
        vo.properties.put("longitude", 127);


            

Reported by PMD.

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

Line: 15

              
public class JSONFieldTest_unwrapped_1 extends TestCase {

    public void test_jsonField() throws Exception {
        VO vo = new VO();
        vo.id = 123;
        vo.properties.put("latitude", 37);
        vo.properties.put("longitude", 127);


            

Reported by PMD.

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

Line: 18

                  public void test_jsonField() throws Exception {
        VO vo = new VO();
        vo.id = 123;
        vo.properties.put("latitude", 37);
        vo.properties.put("longitude", 127);

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);


            

Reported by PMD.

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

Line: 19

                      VO vo = new VO();
        vo.id = 123;
        vo.properties.put("latitude", 37);
        vo.properties.put("longitude", 127);

        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

                      Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }


            

Reported by PMD.

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

Line: 26

              
        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

              
        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 27

                      VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {
        public int id;

            

Reported by PMD.

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

Line: 27

                      VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {
        public int id;

            

Reported by PMD.

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

Line: 32

                  }

    public static class VO {
        public int id;

        @JSONField(unwrapped = true)
        public Map<String, Object> properties = new LinkedHashMap<String, Object>();
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1500/Issue1572.java
13 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 10

              import java.util.Set;

public class Issue1572 extends TestCase {
    public void test_for_issue() throws Exception {
        Person person = new Person();

        person.setId("1001");

        person.setName("1001");

            

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

              import java.util.Set;

public class Issue1572 extends TestCase {
    public void test_for_issue() throws Exception {
        Person person = new Person();

        person.setId("1001");

        person.setName("1001");

            

Reported by PMD.

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

Line: 13

                  public void test_for_issue() throws Exception {
        Person person = new Person();

        person.setId("1001");

        person.setName("1001");

        Map<String, Object> pathValues = JSONPath.paths(person);
        Set<String> paths = pathValues.keySet();

            

Reported by PMD.

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

Line: 18

                      person.setName("1001");

        Map<String, Object> pathValues = JSONPath.paths(person);
        Set<String> paths = pathValues.keySet();

        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      Map<String, Object> pathValues = JSONPath.paths(person);
        Set<String> paths = pathValues.keySet();

        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }


            

Reported by PMD.

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

Line: 20

                      Map<String, Object> pathValues = JSONPath.paths(person);
        Set<String> paths = pathValues.keySet();

        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }


            

Reported by PMD.

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

Line: 21

                      Set<String> paths = pathValues.keySet();

        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }

    public static class Person {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      Set<String> paths = pathValues.keySet();

        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }

    public static class Person {

            

Reported by PMD.

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

Line: 22

              
        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }

    public static class Person {
        private String name;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

              
        assertEquals(3, paths.size());
        assertEquals("1001", pathValues.get("/id"));
        assertEquals("1001", pathValues.get("/name"));
        assertSame(person, pathValues.get("/"));
    }

    public static class Person {
        private String name;

            

Reported by PMD.

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

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

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:123}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:123}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());

            

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, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }


            

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, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }


            

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, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 30

                      Iterator<Map.Entry<MessageQueue, AtomicLong>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicLong> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123L, entry.getValue().longValue());
    }

    public static class OffsetSerializeWrapper {

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2300/Issue2371.java
13 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

              import java.util.List;

public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }


            

Reported by PMD.

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

Line: 11

              import java.util.List;

public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }


            

Reported by PMD.

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

Line: 13

              public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

              public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";

            

Reported by PMD.

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

Line: 13

              public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";

            

Reported by PMD.

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

Line: 13

              public class Issue2371 extends TestCase {
    public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                  public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";
        RpcRespObj<List<T>> result = JSON.parseObject(str, new TypeReference<RpcRespObj<List<T>>>(type) {});

            

Reported by PMD.

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

Line: 14

                  public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";
        RpcRespObj<List<T>> result = JSON.parseObject(str, new TypeReference<RpcRespObj<List<T>>>(type) {});

            

Reported by PMD.

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

Line: 14

                  public void test_for_issue() throws Exception {
        RpcRespObj<List<Resource>> resources = convertResult(Resource.class);
        assertEquals(2, resources.data.get(0).resourceId.intValue());
        assertEquals("own佛恩", resources.data.get(0).resourceName);
    }

    public static <T> RpcRespObj<List<T>> convertResult(Class<T> type) {
        String str = "{\"status\":0,\"data\":[{\"resourceId\":2,\"resourceName\":\"own佛恩\",\"systemCode\":\"ad\"}]}";
        RpcRespObj<List<T>> result = JSON.parseObject(str, new TypeReference<RpcRespObj<List<T>>>(type) {});

            

Reported by PMD.

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

Line: 28

                      public Integer status;
        public Integer errcode;
        public Integer errno;
        public T data;
    }


    public static class Resource {
        public Integer resourceId;

            

Reported by PMD.

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

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

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:123}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:123}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());

            

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, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }


            

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, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }


            

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, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

                      
        Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 30

                      Iterator<Map.Entry<MessageQueue, AtomicInteger>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicInteger> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(123, entry.getValue().intValue());
    }

    public static class OffsetSerializeWrapper {

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

            

Reported by PMD.

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

Line: 22

                      b.value1 = map;

        String jsonStr = JSON.toJSONString(b);
        System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        assertEquals(jsonStr, JSON.toJSONString(obj));

    }


            

Reported by PMD.

System.out.println is used
Design

Line: 37

                      b.value = map;

        String jsonStr = JSON.toJSONString(b);
        System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        System.out.println(obj.toString());
        assertNotNull(obj.value1);
        assertEquals(jsonStr, JSON.toJSONString(obj));
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 39

                      String jsonStr = JSON.toJSONString(b);
        System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        System.out.println(obj.toString());
        assertNotNull(obj.value1);
        assertEquals(jsonStr, JSON.toJSONString(obj));
    }

    public static class DataSimpleVO {

            

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

               * Created by wenshao on 05/08/2017.
 */
public class Issue1363 extends TestCase {
    public void test_for_issue() throws Exception {
        DataSimpleVO a = new DataSimpleVO("a", 1);
        DataSimpleVO b = new DataSimpleVO("b", 2);
        b.value = a;
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(a.name, a);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                      String jsonStr = JSON.toJSONString(b);
        System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        assertEquals(jsonStr, JSON.toJSONString(obj));

    }

    public void test_for_issue_1() throws Exception {
        DataSimpleVO a = new DataSimpleVO("a", 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: 28

              
    }

    public void test_for_issue_1() throws Exception {
        DataSimpleVO a = new DataSimpleVO("a", 1);
        DataSimpleVO b = new DataSimpleVO("b", 2);
        b.value1 = a;
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(a.name, a);

            

Reported by PMD.

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

Line: 28

              
    }

    public void test_for_issue_1() throws Exception {
        DataSimpleVO a = new DataSimpleVO("a", 1);
        DataSimpleVO b = new DataSimpleVO("b", 2);
        b.value1 = a;
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(a.name, a);

            

Reported by PMD.

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

Line: 39

                      String jsonStr = JSON.toJSONString(b);
        System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        System.out.println(obj.toString());
        assertNotNull(obj.value1);
        assertEquals(jsonStr, JSON.toJSONString(obj));
    }

    public static class DataSimpleVO {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                      System.out.println(jsonStr);
        DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        System.out.println(obj.toString());
        assertNotNull(obj.value1);
        assertEquals(jsonStr, JSON.toJSONString(obj));
    }

    public static class DataSimpleVO {
        public String name;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 41

                      DataSimpleVO obj = JSON.parseObject(jsonStr, DataSimpleVO.class);
        System.out.println(obj.toString());
        assertNotNull(obj.value1);
        assertEquals(jsonStr, JSON.toJSONString(obj));
    }

    public static class DataSimpleVO {
        public String name;
        public Object value;

            

Reported by PMD.

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

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

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:true}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicBoolean>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicBoolean> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get());

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"offsetTable\":{{\"items\":[]}:true}}", text);
        
        OffsetSerializeWrapper wrapper2 = JSON.parseObject(text, OffsetSerializeWrapper.class);
        Assert.assertEquals(1, wrapper2.getOffsetTable().size());
        
        Iterator<Map.Entry<MessageQueue, AtomicBoolean>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicBoolean> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get());

            

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, AtomicBoolean>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicBoolean> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get());
    }


            

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, AtomicBoolean>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicBoolean> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get());
    }


            

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, AtomicBoolean>> iter = wrapper2.getOffsetTable().entrySet().iterator();
        Map.Entry<MessageQueue, AtomicBoolean> entry = iter.next();
        Assert.assertEquals(0, entry.getKey().getItems().size());
        Assert.assertEquals(true, entry.getValue().get());
    }


            

Reported by PMD.

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

Line: 29

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

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

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

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 29

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

    public static class OffsetSerializeWrapper {


            

Reported by PMD.

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

Line: 30

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

    public static class OffsetSerializeWrapper {

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

            

Reported by PMD.