The following issues were found

src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_2.java
9 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 13

              
public class JSONFieldTest_unwrapped_2 extends TestCase {

    public void test_jsonField() throws Exception {
        String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

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

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 13

              
public class JSONFieldTest_unwrapped_2 extends TestCase {

    public void test_jsonField() throws Exception {
        String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      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.

JUnit assertions should include a message
Design

Line: 19

              
        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.

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

Line: 19

              
        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.

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

Line: 20

                      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.

JUnit assertions should include a message
Design

Line: 20

                      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.

Private field 'properties' could be made final; it is only initialized in the declaration or constructor.
Design

Line: 27

                  public static class VO {
        public int id;

        private Map<String, Object> properties = new LinkedHashMap<String, Object>();

        @JSONField(unwrapped = true)
        public void setProperty(String key, Object value) {
            properties.put(key, value);
        }

            

Reported by PMD.

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

Line: 27

                  public static class VO {
        public int id;

        private Map<String, Object> properties = new LinkedHashMap<String, Object>();

        @JSONField(unwrapped = true)
        public void setProperty(String key, Object value) {
            properties.put(key, value);
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_0.java
9 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 10

              
public class JSONFieldTest_unwrapped_0 extends TestCase {

    public void test_jsonField() throws Exception {
        VO vo = new VO();
        vo.id = 123;
        vo.localtion = new Localtion(127, 37);

        String text = JSON.toJSONString(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: 10

              
public class JSONFieldTest_unwrapped_0 extends TestCase {

    public void test_jsonField() throws Exception {
        VO vo = new VO();
        vo.id = 123;
        vo.localtion = new Localtion(127, 37);

        String text = JSON.toJSONString(vo);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

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

        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.localtion);
        assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
        assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
    }

    public static class VO {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              
        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.localtion);
        assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
        assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
    }

    public static class VO {
        public int id;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.localtion);
        assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
        assertEquals(vo.localtion.longitude, vo2.localtion.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: 25

                  }

    public static class VO {
        public int id;

        @JSONField(unwrapped = true)
        public Localtion localtion;
    }


            

Reported by PMD.

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

Line: 28

                      public int id;

        @JSONField(unwrapped = true)
        public Localtion localtion;
    }

    public static class Localtion {
        public int longitude;
        public int latitude;

            

Reported by PMD.

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

Line: 32

                  }

    public static class Localtion {
        public int longitude;
        public int latitude;

        public Localtion() {

        }

            

Reported by PMD.

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

Line: 33

              
    public static class Localtion {
        public int longitude;
        public int latitude;

        public Localtion() {

        }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/IntFieldTest2.java
9 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: 17

              
public class IntFieldTest2 extends TestCase {

    public void test_model() throws Exception {
        Model model = new Model();
        model.id = -1001;
        model.id2 = -1002;

        String text = JSON.toJSONString(model);

            

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("{\"id\":-1001,\"id2\":-1002}", text);
    }

    public void test_model_max() throws Exception {
        Model model = new Model();
        model.id = Integer.MIN_VALUE;
        model.id2 = Integer.MAX_VALUE;

        String text = JSON.toJSONString(model);

            

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

                      }
    }

    public void test_model_map() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
        });

            

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

                      reader.close();
    }

    public void test_model_map_error() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        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: 68

                      Assert.assertNotNull(error);
    }
    
    public void test_model_map_error_2() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {

            

Reported by PMD.

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

Line: 84

              
    public static class Model {

        public int id;
        public int id2;
    }
}

            

Reported by PMD.

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

Line: 85

                  public static class Model {

        public int id;
        public int id2;
    }
}

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '57'-'63').
Error

Line: 57

                  public void test_model_map_error() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {
            reader.readObject(new TypeReference<Map<String, Model>>() {
            });
        } catch (JSONException ex) {

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '71'-'77').
Error

Line: 71

                  public void test_model_map_error_2() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {
            reader.readObject(new TypeReference<Map<String, Model>>() {
            });
        } catch (JSONException ex) {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue87_hashset.java
9 issues
System.out.println is used
Design

Line: 18

                      to.add("test1");
        to.add("test2");
        String text = JSON.toJSONString(to);
        System.out.println(text);
        JSONObject jo = JSON.parseObject(text);
        to = JSON.toJavaObject(jo, TestObject.class);
    }
    
    public static class TestObject {

            

Reported by PMD.

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

Line: 13

              

public class Issue87_hashset extends TestCase {
    public void test_for_issue() throws Exception {
        TestObject to = new TestObject();
        to.add("test1");
        to.add("test2");
        String text = JSON.toJSONString(to);
        System.out.println(text);

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 13

              

public class Issue87_hashset extends TestCase {
    public void test_for_issue() throws Exception {
        TestObject to = new TestObject();
        to.add("test1");
        to.add("test2");
        String text = JSON.toJSONString(to);
        System.out.println(text);

            

Reported by PMD.

The value assigned to variable 'to' is never used
Design

Line: 20

                      String text = JSON.toJSONString(to);
        System.out.println(text);
        JSONObject jo = JSON.parseObject(text);
        to = JSON.toJavaObject(jo, TestObject.class);
    }
    
    public static class TestObject {

        private HashSet<String> set = new HashSet<String>(0);

            

Reported by PMD.

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

Line: 25

                  
    public static class TestObject {

        private HashSet<String> set = new HashSet<String>(0);

        public HashSet<String> getSet() {
            return set;
        }


            

Reported by PMD.

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

Line: 27

              
        private HashSet<String> set = new HashSet<String>(0);

        public HashSet<String> getSet() {
            return set;
        }

        public void setSet(HashSet<String> set) {
            this.set = set;

            

Reported by PMD.

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

Line: 31

                          return set;
        }

        public void setSet(HashSet<String> set) {
            this.set = set;
        }

        public void add(String str) {
            set.add(str);

            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.bug;

import java.util.HashSet;
import java.util.Set;

import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

            

Reported by PMD.

Found 'DU'-anomaly for variable 'to' (lines '20'-'21').
Error

Line: 20

                      String text = JSON.toJSONString(to);
        System.out.println(text);
        JSONObject jo = JSON.parseObject(text);
        to = JSON.toJavaObject(jo, TestObject.class);
    }
    
    public static class TestObject {

        private HashSet<String> set = new HashSet<String>(0);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1700/Issue1764_bean.java
9 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 static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;

public class Issue1764_bean extends TestCase {
    public void test_for_issue() throws Exception {
        assertEquals("{\"value\":\"9007199254741992\"}"
                , JSON.toJSONString(
                        new Model(9007199254741992L)));

        assertEquals("{\"value\":\"9007199254741990\"}"

            

Reported by PMD.

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

Line: 11

              import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;

public class Issue1764_bean extends TestCase {
    public void test_for_issue() throws Exception {
        assertEquals("{\"value\":\"9007199254741992\"}"
                , JSON.toJSONString(
                        new Model(9007199254741992L)));

        assertEquals("{\"value\":\"9007199254741990\"}"

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              
public class Issue1764_bean extends TestCase {
    public void test_for_issue() throws Exception {
        assertEquals("{\"value\":\"9007199254741992\"}"
                , JSON.toJSONString(
                        new Model(9007199254741992L)));

        assertEquals("{\"value\":\"9007199254741990\"}"
                , JSON.toJSONString(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                              , JSON.toJSONString(
                        new Model(9007199254741992L)));

        assertEquals("{\"value\":\"9007199254741990\"}"
                , JSON.toJSONString(
                        new Model(9007199254741990L)));

        assertEquals("{\"value\":100}"
                , JSON.toJSONString(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                              , JSON.toJSONString(
                        new Model(9007199254741990L)));

        assertEquals("{\"value\":100}"
                , JSON.toJSONString(
                        new Model(100L)));

        assertEquals("{\"value\":\"-9007199254741990\"}"
                , JSON.toJSONString(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

                              , JSON.toJSONString(
                        new Model(100L)));

        assertEquals("{\"value\":\"-9007199254741990\"}"
                , JSON.toJSONString(
                        new Model(-9007199254741990L)));

        assertEquals("{\"value\":-9007199254740990}"
                , JSON.toJSONString(

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

                              , JSON.toJSONString(
                        new Model(-9007199254741990L)));

        assertEquals("{\"value\":-9007199254740990}"
                , JSON.toJSONString(
                        new Model(-9007199254740990L)));

    }


            

Reported by PMD.

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

Line: 38

              
    @JSONType(serialzeFeatures = BrowserCompatible)
    public static class Model {
        public long value;

        public Model() {

        }


            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.issue_1700;

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

import static com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible;


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/BooleanFieldTest2.java
9 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 14

              
public class BooleanFieldTest2 extends TestCase {

    public void test_true() throws Exception {
        String text = "{\"f001\":1001,\"value\":true}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertTrue(model.value);
    }

            

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.assertTrue(model.value);
    }

    public void test_false() throws Exception {
        String text = "{\"f001\":1001,\"value\":false}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertFalse(model.value);
    }

            

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

                      Assert.assertFalse(model.value);
    }

    public void test_true_reader() throws Exception {
        String text = "{\"f001\":1001,\"value\":true}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertTrue(model.value);

            

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

                      reader.close();
    }

    public void test_false_reader() throws Exception {
        String text = "{\"f001\":1001,\"value\":false}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertFalse(model.value);

            

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

                      reader.close();
    }
    
    public void test_1() throws Exception {
        String text = "{\"value\":1}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertTrue(model.value);
    }

            

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

                      Assert.assertTrue(model.value);
    }
    
    public void test_0() throws Exception {
        String text = "{\"value\":0}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertFalse(model.value);
    }

            

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

                      Assert.assertFalse(model.value);
    }
    
    public void test_1_reader() throws Exception {
        String text = "{\"value\":1}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertTrue(model.value);

            

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

                      reader.close();
    }
    
    public void test_0_reader() throws Exception {
        String text = "{\"value\":0}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertFalse(model.value);

            

Reported by PMD.

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

Line: 80

              
    public static class Model {

        public boolean value;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArray2Test.java
9 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 10

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

            

Reported by PMD.

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

Line: 10

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

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


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

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

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

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

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

            

Reported by PMD.

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

Line: 21

                  }

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest6.java
9 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 13

              
public class JSONFieldTest6 extends TestCase {

    public void test_for_issue1()
    {
        NonStringMap nonStringMap = new NonStringMap();
        Map<Integer, Integer> map1 = new HashMap();
        map1.put( 111,666 );
        nonStringMap.setMap1( map1 );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      map1.put( 111,666 );
        nonStringMap.setMap1( map1 );
        String json = JSON.toJSONString( nonStringMap );
        assertEquals( "{\"map1\":{\"111\":666}}", json );
    }

    public void test_for_issue2()
    {
        NonStringMap nonStringMap = new NonStringMap();

            

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

                      assertEquals( "{\"map1\":{\"111\":666}}", json );
    }

    public void test_for_issue2()
    {
        NonStringMap nonStringMap = new NonStringMap();
        Map<Integer, Integer> map2 = new HashMap();
        map2.put( 222,888 );
        nonStringMap.setMap2( map2 );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

                      map2.put( 222,888 );
        nonStringMap.setMap2( map2 );
        String json = JSON.toJSONString( nonStringMap );
        assertEquals( "{\"map2\":{222:\"888\"}}", json );
    }

    public void test_for_issue3()
    {
        NonStringMap nonStringMap = new NonStringMap();

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 33

                      assertEquals( "{\"map2\":{222:\"888\"}}", json );
    }

    public void test_for_issue3()
    {
        NonStringMap nonStringMap = new NonStringMap();
        Map<Integer, Integer> map3 = new HashMap();
        map3.put( 333,999 );
        nonStringMap.setMap3( map3 );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 40

                      map3.put( 333,999 );
        nonStringMap.setMap3( map3 );
        String json = JSON.toJSONString( nonStringMap );
        assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
    }

    public void test_for_issue4()
    {
        NonStringMap nonStringMap = new NonStringMap();

            

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

                      assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
    }

    public void test_for_issue4()
    {
        NonStringMap nonStringMap = new NonStringMap();
        Bean person = new Bean();
        person.setAge( 23 );
        nonStringMap.setPerson( person );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 50

                      person.setAge( 23 );
        nonStringMap.setPerson( person );
        String json = JSON.toJSONString( nonStringMap );
        assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
    }

    class NonStringMap
    {
        @JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )

            

Reported by PMD.

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

Line: 53

                      assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
    }

    class NonStringMap
    {
        @JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )
        private Map map1;

        public Map getMap1()

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest6.java
9 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 TypeReferenceTest6 extends TestCase {

	public void test_typeRef() throws Exception {
		TypeReference<Map<String, Entity>> typeRef = new TypeReference<Map<String, Entity>>() {
		};

		Map<String, Entity> map = JSON.parseObject(
				"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);

            

Reported by PMD.

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

Line: 22

              		Map<String, Entity> map = JSON.parseObject(
				"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);

		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

            

Reported by PMD.

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

Line: 24

              
		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {

            

Reported by PMD.

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

Line: 25

              		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

            

Reported by PMD.

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

Line: 25

              		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 29

              		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

		private List<A> list = new ArrayList<A>();

		public String getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/TreeSetFieldTest.java
8 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 13

              
public class TreeSetFieldTest extends TestCase {

    public void test_null() throws Exception {
        Entity value = JSON.parseObject("{value:null}", Entity.class);
        Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {

            

Reported by PMD.

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

Line: 15

              
    public void test_null() throws Exception {
        Entity value = JSON.parseObject("{value:null}", Entity.class);
        Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());

            

Reported by PMD.

JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 18

                      Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

            

Reported by PMD.

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

Line: 20

              
    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

        private TreeSet value;

            

Reported by PMD.

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

Line: 20

              
    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

        private TreeSet value;

            

Reported by PMD.

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

Line: 25

              
    private static class Entity {

        private TreeSet value;

        public TreeSet getValue() {
            return value;
        }


            

Reported by PMD.

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

Line: 27

              
        private TreeSet value;

        public TreeSet getValue() {
            return value;
        }

        public void setValue(TreeSet value) {
            this.value = value;

            

Reported by PMD.

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

Line: 31

                          return value;
        }

        public void setValue(TreeSet value) {
            this.value = value;
        }
    }
}

            

Reported by PMD.