The following issues were found

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/issue_1700/Issue1764_bean_biginteger_type.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: 12

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

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

        assertEquals("{\"value\":\"-9007199254741992\"}"

            

Reported by PMD.

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

Line: 12

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

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

        assertEquals("{\"value\":\"-9007199254741992\"}"

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

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

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

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

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

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

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 29

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

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

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 33

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

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



            

Reported by PMD.

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

Line: 42

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

        public Model() {

        }


            

Reported by PMD.

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

Line: 22

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

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


            

Reported by PMD.

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

Line: 14

              import com.alibaba.fastjson.serializer.SerializerFeature;

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

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

            

Reported by PMD.

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

Line: 15

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

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

            

Reported by PMD.

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

Line: 18

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

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

            

Reported by PMD.

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

Line: 28

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

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().iterator().next() instanceof B);
    }

    public static class A {


            

Reported by PMD.

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

Line: 28

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

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().iterator().next() instanceof B);
    }

    public static class A {


            

Reported by PMD.

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

Line: 29

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

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().iterator().next() instanceof B);
    }

    public static class A {

        private Collection<B> list;

            

Reported by PMD.

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

Line: 29

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

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().iterator().next() instanceof B);
    }

    public static class A {

        private Collection<B> list;

            

Reported by PMD.

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

Line: 29

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

        Assert.assertEquals(1, a1.getList().size());
        Assert.assertTrue(a1.getList().iterator().next() instanceof B);
    }

    public static class A {

        private Collection<B> list;

            

Reported by PMD.

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

Line: 16

              import junit.framework.TestCase;

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

    public void test_get() throws Exception {
        JSONObject obj = JSON.parseObject("{\"value\":{}}");

            

Reported by PMD.

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

Line: 17

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

    public void test_get() throws Exception {
        JSONObject obj = JSON.parseObject("{\"value\":{}}");
        JSONObject value = (JSONObject) obj.getObject("value", Object.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: 20

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

    public void test_get() throws Exception {
        JSONObject obj = JSON.parseObject("{\"value\":{}}");
        JSONObject value = (JSONObject) obj.getObject("value", Object.class);
        Assert.assertEquals(0, value.size());
    }
    

            

Reported by PMD.

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

Line: 22

              
    public void test_get() throws Exception {
        JSONObject obj = JSON.parseObject("{\"value\":{}}");
        JSONObject value = (JSONObject) obj.getObject("value", Object.class);
        Assert.assertEquals(0, value.size());
    }
    
    public void test_get_obj() throws Exception {
        JSONObject obj = new JSONObject();

            

Reported by PMD.

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

Line: 23

                  public void test_get() throws Exception {
        JSONObject obj = JSON.parseObject("{\"value\":{}}");
        JSONObject value = (JSONObject) obj.getObject("value", Object.class);
        Assert.assertEquals(0, value.size());
    }
    
    public void test_get_obj() throws Exception {
        JSONObject obj = new JSONObject();
        {

            

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(0, value.size());
    }
    
    public void test_get_obj() throws Exception {
        JSONObject obj = new JSONObject();
        {
            Map<String, Object> value = new HashMap<String, Object>();
            value.put("@type", "com.alibaba.json.bvt.JSONObjectTest_get_2$VO");
            value.put("id", 1001);

            

Reported by PMD.

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

Line: 30

                      JSONObject obj = new JSONObject();
        {
            Map<String, Object> value = new HashMap<String, Object>();
            value.put("@type", "com.alibaba.json.bvt.JSONObjectTest_get_2$VO");
            value.put("id", 1001);
            obj.put("value", value);
        }
        VO value = (VO) obj.getObject("value", Object.class);
        Assert.assertEquals(1001, value.getId());

            

Reported by PMD.

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

Line: 31

                      {
            Map<String, Object> value = new HashMap<String, Object>();
            value.put("@type", "com.alibaba.json.bvt.JSONObjectTest_get_2$VO");
            value.put("id", 1001);
            obj.put("value", value);
        }
        VO value = (VO) obj.getObject("value", Object.class);
        Assert.assertEquals(1001, value.getId());
    }

            

Reported by PMD.

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

Line: 35

                          obj.put("value", value);
        }
        VO value = (VO) obj.getObject("value", Object.class);
        Assert.assertEquals(1001, value.getId());
    }

    public static interface VO {
        @JSONField()
        int getId();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue_for_gaorui.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: 8

              import junit.framework.TestCase;

public class Issue_for_gaorui extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";

        JSON.parseObject(json, Object.class, Feature.SupportAutoType);
    }


            

Reported by PMD.

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

Line: 8

              import junit.framework.TestCase;

public class Issue_for_gaorui extends TestCase {
    public void test_for_issue() throws Exception {
        String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";

        JSON.parseObject(json, Object.class, Feature.SupportAutoType);
    }


            

Reported by PMD.

The class 'PromotionTermDetail' is suspected to be a Data Class (WOC=22.222%, NOPA=0, NOAM=14, WMC=18)
Design

Line: 14

                      JSON.parseObject(json, Object.class, Feature.SupportAutoType);
    }

    public static class PromotionTermDetail {
        /**
         * 卡券Id
         */
        private Long couponId;
        /**

            

Reported by PMD.

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

Line: 40

                      /**
         * 是否能够获取到该优惠
         */
        private boolean isMatch = false;
        /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**

            

Reported by PMD.

Avoid using redundant field initializer for 'isMatch'
Performance

Line: 40

                      /**
         * 是否能够获取到该优惠
         */
        private boolean isMatch = false;
        /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**

            

Reported by PMD.

Field isMatch has the same name as a method
Error

Line: 40

                      /**
         * 是否能够获取到该优惠
         */
        private boolean isMatch = false;
        /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**

            

Reported by PMD.

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

Line: 44

                      /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**
         * 未获取到优惠的原因
         */
        private String reasonForLose;
        /**

            

Reported by PMD.

Avoid using redundant field initializer for 'isChoose'
Performance

Line: 44

                      /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**
         * 未获取到优惠的原因
         */
        private String reasonForLose;
        /**

            

Reported by PMD.

Field isChoose has the same name as a method
Error

Line: 44

                      /**
         * 是否选择了该优惠
         */
        private boolean isChoose = false;
        /**
         * 未获取到优惠的原因
         */
        private String reasonForLose;
        /**

            

Reported by PMD.

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

Line: 9

              import junit.framework.TestCase;

public class Issue1683 extends TestCase {
    public void test_for_issue() throws Exception {
        String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
        BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);

            

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

              import junit.framework.TestCase;

public class Issue1683 extends TestCase {
    public void test_for_issue() throws Exception {
        String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
        BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);

            

Reported by PMD.

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

Line: 12

                  public void test_for_issue() throws Exception {
        String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
        BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                  public void test_for_issue() throws Exception {
        String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
        BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                      String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
        BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }

    @JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
        assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }

    @JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
    public static class BookDO {

            

Reported by PMD.

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

Line: 15

                      assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }

    @JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
    public static class BookDO {


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertEquals(2L, book.bookId.longValue());
        assertEquals("浪漫奇侠", book.bookName);
        assertEquals("雨天不打伞", book.authorName);
        assertEquals(4536, book.wordCount.intValue());
    }

    @JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
    public static class BookDO {


            

Reported by PMD.

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

Line: 19

                  }

    @JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
    public static class BookDO {

        private Long bookId;

        private String bookName;


            

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/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/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/issue_3400/Issue_20201016_01.java
9 issues
System.out.println is used
Design

Line: 21

                      String s = JSON.toJSONString(config, SerializerFeature.WriteMapNullValue,
                SerializerFeature.QuoteFieldNames, SerializerFeature.WriteNullListAsEmpty);

        System.out.println(s);
    }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

            

Reported by PMD.

System.out.println is used
Design

Line: 28

                  public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }

    public static class Config {
        private UserConfig creator;
        private UserConfig owner;

            

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

              import junit.framework.TestCase;

public class Issue_20201016_01 extends TestCase {
    public void testToString() {
        UserConfig user = new UserConfig();
        user.setAccount("account");
        user.setName("name");

        Config config = new Config();

            

Reported by PMD.

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

Line: 9

              import junit.framework.TestCase;

public class Issue_20201016_01 extends TestCase {
    public void testToString() {
        UserConfig user = new UserConfig();
        user.setAccount("account");
        user.setName("name");

        Config config = new Config();

            

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

                  }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }


            

Reported by PMD.

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

Line: 25

                  }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }


            

Reported by PMD.

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

Line: 31

                      System.out.println( JSON.parseObject(s, Config.class));
    }

    public static class Config {
        private UserConfig creator;
        private UserConfig owner;
        private UserConfig agent;

        public UserConfig getCreator() {

            

Reported by PMD.

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

Line: 56

                      }
    }

    public static class UserConfig {
        private String workid;
        private String name;
        private String account;

        public String getWorkid() {

            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.issue_3400;

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

public class Issue_20201016_01 extends TestCase {
    public void testToString() {

            

Reported by PMD.