The following issues were found

src/test/java/com/alibaba/json/bvtVO/DataTransaction2.java
25 issues
System.out.println is used
Design

Line: 299

              
        String jsonString = "{'head' : {'appid':'epas','transcode' : '000000','seqno' : '111111111',        'user' : {          'id' : '00000'},        'ret' : {           'code' : '1',           'msg' : 'txt'}  },  'body' : {      param : {           form:{              name : '111',               sex : '1',              address : 'street1',                array : [ {                 id : '1',                   name : 'tom1'               }, {                    id : '2',                   name : 'tom2'               } ]},           limit : {               start : 1,              size : 25,              total : 100}        },      dataset : {         total : 1000,           rows : [ {              id : 'id',              name : 'name'           }, {                id : 'id',              name : 'name'           } ]     }   }}";
        DataTransaction2 dt = DataTransaction2.fromJSON(jsonString);
        System.out.println(dt.toJSON());
        DataTransaction2 dt1 = JSON.parseObject(dt.toJSON(), DataTransaction2.class);
        System.out.println(dt1.toJSON());
        
        Assert.assertEquals(dt.toJSON(), dt1.toJSON());
        

            

Reported by PMD.

System.out.println is used
Design

Line: 301

                      DataTransaction2 dt = DataTransaction2.fromJSON(jsonString);
        System.out.println(dt.toJSON());
        DataTransaction2 dt1 = JSON.parseObject(dt.toJSON(), DataTransaction2.class);
        System.out.println(dt1.toJSON());
        
        Assert.assertEquals(dt.toJSON(), dt1.toJSON());
        
        System.out.println("=================");
        System.out.println(dt.toJSON());

            

Reported by PMD.

System.out.println is used
Design

Line: 305

                      
        Assert.assertEquals(dt.toJSON(), dt1.toJSON());
        
        System.out.println("=================");
        System.out.println(dt.toJSON());
        dt.setRetMsgCode("-1", "错误");
        dt.setDataSet("1000", new ArrayList<Map<String, Object>>());
        System.out.println(dt.toJSON());
        

            

Reported by PMD.

System.out.println is used
Design

Line: 306

                      Assert.assertEquals(dt.toJSON(), dt1.toJSON());
        
        System.out.println("=================");
        System.out.println(dt.toJSON());
        dt.setRetMsgCode("-1", "错误");
        dt.setDataSet("1000", new ArrayList<Map<String, Object>>());
        System.out.println(dt.toJSON());
        
        String text = dt.toJSON();

            

Reported by PMD.

System.out.println is used
Design

Line: 309

                      System.out.println(dt.toJSON());
        dt.setRetMsgCode("-1", "错误");
        dt.setDataSet("1000", new ArrayList<Map<String, Object>>());
        System.out.println(dt.toJSON());
        
        String text = dt.toJSON();
        System.out.println(text);
        
        DataTransaction2 dt2 = JSON.parseObject(text, DataTransaction2.class);

            

Reported by PMD.

System.out.println is used
Design

Line: 312

                      System.out.println(dt.toJSON());
        
        String text = dt.toJSON();
        System.out.println(text);
        
        DataTransaction2 dt2 = JSON.parseObject(text, DataTransaction2.class);
        System.out.println(JSON.toJSONString(dt2));

        Assert.assertEquals(dt.toJSON(), dt2.toJSON());

            

Reported by PMD.

System.out.println is used
Design

Line: 315

                      System.out.println(text);
        
        DataTransaction2 dt2 = JSON.parseObject(text, DataTransaction2.class);
        System.out.println(JSON.toJSONString(dt2));

        Assert.assertEquals(dt.toJSON(), dt2.toJSON());
    }
}

            

Reported by PMD.

This class has a bunch of public methods and attributes
Design

Line: 1

              package com.alibaba.json.bvtVO;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


            

Reported by PMD.

The class 'Head' is suspected to be a Data Class (WOC=15.385%, NOPA=0, NOAM=10, WMC=13)
Design

Line: 32

                  /**
     * Head
     **/
    class Head {

        private String appid;

        private String transcode;


            

Reported by PMD.

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

Line: 63

                      /**
         * 处理结果
         * */
        class Ret {
            private String code;
            private String msg;

            public String getCode() {
                return code;

            

Reported by PMD.

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

    public void test_0() throws Exception {
        PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                return false;
            }

            

Reported by PMD.

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

Line: 27

              
        SerializeWriter out = new SerializeWriter();
        JSONSerializer serializer = new JSONSerializer(out);
        serializer.getPropertyFilters().add(filter);

        A a = new A();
        serializer.write(a);

        String text = out.toString();

            

Reported by PMD.

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

Line: 36

                      Assert.assertEquals("{}", text);
    }
    
    public void test_toJSONString() throws Exception {
        PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                return false;
            }

            

Reported by PMD.

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

Line: 47

                      Assert.assertEquals("{}", JSON.toJSONString(new A(), filter));
    }

    public void test_1() throws Exception {
        PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                if ("id".equals(name)) {
                    return true;

            

Reported by PMD.

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

Line: 60

              
        SerializeWriter out = new SerializeWriter();
        JSONSerializer serializer = new JSONSerializer(out);
        serializer.getPropertyFilters().add(filter);

        A a = new A();
        serializer.write(a);

        String text = out.toString();

            

Reported by PMD.

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

Line: 69

                      Assert.assertEquals("{\"id\":0}", text);
    }

    public void test_2() throws Exception {
        PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                if ("name".equals(name)) {
                    return true;

            

Reported by PMD.

The String literal 'name' appears 5 times in this file; the first occurrence is on line 73
Error

Line: 73

                      PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                if ("name".equals(name)) {
                    return true;
                }
                return false;
            }
        };

            

Reported by PMD.

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

Line: 82

              
        SerializeWriter out = new SerializeWriter();
        JSONSerializer serializer = new JSONSerializer(out);
        serializer.getPropertyFilters().add(filter);

        A a = new A();
        a.setName("chennp2008");
        serializer.write(a);


            

Reported by PMD.

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

Line: 92

                      Assert.assertEquals("{\"name\":\"chennp2008\"}", text);
    }

    public void test_3() throws Exception {
        PropertyFilter filter = new PropertyFilter() {

            public boolean apply(Object source, String name, Object value) {
                if ("name".equals(name)) {
                    return true;

            

Reported by PMD.

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

Line: 105

              
        SerializeWriter out = new SerializeWriter();
        JSONSerializer serializer = new JSONSerializer(out);
        serializer.getPropertyFilters().add(filter);

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("name", "chennp2008");
        serializer.write(map);


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/support/moneta/MoneyNumberTest.java
25 issues
Avoid instantiating Short objects. Call Short.valueOf() instead
Performance

Line: 47

                      assertEquals(2.01f, moneyBack.getNumber().floatValue());

        // short
        money = Money.of(new Short("2"), Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(2, moneyBack.getNumber().shortValue());

        // BigInteger

            

Reported by PMD.

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

Line: 15

               * @Date :Created in 01:31 2020/7/4
 */
public class MoneyNumberTest extends TestCase {
    public void test_for_issue() throws Exception {
        // Integer
        Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

            

Reported by PMD.

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

Line: 15

               * @Date :Created in 01:31 2020/7/4
 */
public class MoneyNumberTest extends TestCase {
    public void test_for_issue() throws Exception {
        // Integer
        Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

            

Reported by PMD.

The String literal 'EUR' appears 7 times in this file; the first occurrence is on line 17
Error

Line: 17

              public class MoneyNumberTest extends TestCase {
    public void test_for_issue() throws Exception {
        // Integer
        Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

        // Long

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

        // Long
        money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

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

Line: 20

                      Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

        // Long
        money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

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

Line: 20

                      Money money = Money.of(5000, Monetary.getCurrency("EUR"));
        String moneyJSON = JSON.toJSONString(money);
        Money moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(5000, moneyBack.getNumber().intValue());

        // Long
        money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

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

Line: 26

                      money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(1000, moneyBack.getNumber().longValue());

        // Byte
        money = Money.of(0x4a, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

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

Line: 26

                      money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(1000, moneyBack.getNumber().longValue());

        // Byte
        money = Money.of(0x4a, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

                      money = Money.of(1000L, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);
        assertEquals(1000, moneyBack.getNumber().longValue());

        // Byte
        money = Money.of(0x4a, Monetary.getCurrency("EUR"));
        moneyJSON = JSON.toJSONString(money);
        moneyBack = JSON.parseObject(moneyJSON, Money.class);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/DefaultExtJSONParser_parseArray_2.java
25 issues
Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 24

                      parser.config(Feature.AllowISO8601DateFormat, false);
        List<List<Integer>> list = (List<List<Integer>>) parser.parseArrayWithType(new TypeReference<List<List<Integer>>>() {
        }.getType());
        Assert.assertEquals(new Integer(1), list.get(0).get(0));
    }

    public void test_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2']");
        parser.config(Feature.AllowISO8601DateFormat, false);

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 32

                      parser.config(Feature.AllowISO8601DateFormat, false);
        List<Object> list = new ArrayList<Object>();
        parser.parseArray(Integer.class, list);
        Assert.assertEquals(new Integer(1), list.get(0));
        Assert.assertEquals(new Integer(2), list.get(1));
    }

    public void test_error_0() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2'}");

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 33

                      List<Object> list = new ArrayList<Object>();
        parser.parseArray(Integer.class, list);
        Assert.assertEquals(new Integer(1), list.get(0));
        Assert.assertEquals(new Integer(2), list.get(1));
    }

    public void test_error_0() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2'}");
        parser.config(Feature.AllowISO8601DateFormat, false);

            

Reported by PMD.

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

Line: 19

              @SuppressWarnings("deprecation")
public class DefaultExtJSONParser_parseArray_2 extends TestCase {

	public void test_0() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("[['1']]");
        parser.config(Feature.AllowISO8601DateFormat, false);
        List<List<Integer>> list = (List<List<Integer>>) parser.parseArrayWithType(new TypeReference<List<List<Integer>>>() {
        }.getType());
        Assert.assertEquals(new Integer(1), list.get(0).get(0));

            

Reported by PMD.

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

Line: 24

                      parser.config(Feature.AllowISO8601DateFormat, false);
        List<List<Integer>> list = (List<List<Integer>>) parser.parseArrayWithType(new TypeReference<List<List<Integer>>>() {
        }.getType());
        Assert.assertEquals(new Integer(1), list.get(0).get(0));
    }

    public void test_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2']");
        parser.config(Feature.AllowISO8601DateFormat, false);

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals(new Integer(1), list.get(0).get(0));
    }

    public void test_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2']");
        parser.config(Feature.AllowISO8601DateFormat, false);
        List<Object> list = new ArrayList<Object>();
        parser.parseArray(Integer.class, list);
        Assert.assertEquals(new Integer(1), list.get(0));

            

Reported by PMD.

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

Line: 36

                      Assert.assertEquals(new Integer(2), list.get(1));
    }

    public void test_error_0() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("['1','2'}");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {

            

Reported by PMD.

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

Line: 44

                      try {
            List<Object> list = new ArrayList<Object>();
            parser.parseArray(Integer.class, list);
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }


            

Reported by PMD.

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

Line: 50

                      Assert.assertNotNull(error);
    }

    public void test_error_1() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("[['1']]");
        parser.config(Feature.AllowISO8601DateFormat, false);

        Exception error = null;
        try {

            

Reported by PMD.

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

Line: 58

                      try {
            parser.parseArrayWithType(new TypeReference<Map<?, ?>>() {
            }.getType());
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
    }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue1013.java
25 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 Issue1013 extends TestCase {

    public void test_for_issue() throws Exception {
        TestDomain domain = new TestDomain();

        String json = JSON.toJSONString(domain);

        TestDomain domain1 = JSON.parseObject(json, TestDomain.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

              
        TestDomain domain1 = JSON.parseObject(json, TestDomain.class);

        assertEquals(domain.getList(), domain1.getList());
    }

    public void test_for_issue_1() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);

            

Reported by PMD.

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

Line: 22

              
        TestDomain domain1 = JSON.parseObject(json, TestDomain.class);

        assertEquals(domain.getList(), domain1.getList());
    }

    public void test_for_issue_1() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);

            

Reported by PMD.

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

Line: 25

                      assertEquals(domain.getList(), domain1.getList());
    }

    public void test_for_issue_1() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);
        TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().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: 25

                      assertEquals(domain.getList(), domain1.getList());
    }

    public void test_for_issue_1() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);
        TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());

            

Reported by PMD.

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

Line: 30

                      TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);
        TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());
        assertEquals(Arrays.asList(1, 2), domain2.getList());
    }

    public void test_for_issue_2() throws Exception {


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

                      TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);
        TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());
        assertEquals(Arrays.asList(1, 2), domain2.getList());
    }

    public void test_for_issue_2() throws Exception {


            

Reported by PMD.

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

Line: 30

                      TestDomain domain1 = JSON.parseObject("{\"list\":[]}", TestDomain.class);
        TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());
        assertEquals(Arrays.asList(1, 2), domain2.getList());
    }

    public void test_for_issue_2() throws Exception {


            

Reported by PMD.

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

Line: 31

                      TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());
        assertEquals(Arrays.asList(1, 2), domain2.getList());
    }

    public void test_for_issue_2() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":null}", TestDomain.class);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 31

                      TestDomain domain2 = JSON.parseObject("{\"list\":[1, 2]}", TestDomain.class);

        assertEquals(0, domain1.getList().size());
        assertEquals(Arrays.asList(1, 2), domain2.getList());
    }

    public void test_for_issue_2() throws Exception {

        TestDomain domain1 = JSON.parseObject("{\"list\":null}", TestDomain.class);

            

Reported by PMD.

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

Line: 11

              import java.util.TimeZone;

public class DateTest5_iso8601 extends TestCase {
    protected void setUp() throws Exception {
        JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
        JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() 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: 16

                      JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();

            

Reported by PMD.

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

Line: 16

                      JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();

            

Reported by PMD.

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

Line: 17

                  }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

              
    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();

            

Reported by PMD.

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

Line: 19

                  public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();


            

Reported by PMD.

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

Line: 20

                      Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();

            

Reported by PMD.

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

Line: 21

                      assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(83419000, delta_2_1);

            

Reported by PMD.

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

Line: 22

                      Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19+00:00\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(83419000, delta_2_1);


            

Reported by PMD.

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

Line: 23

                      Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"20180912T151019Z\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-12T15:10:19Z\"}", VO.class).getGmtCreate();
        Date date6 = JSON.parseObject("{\"gmtCreate\":\"20180912\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(83419000, delta_2_1);

        long delta_3_1 = date3.getTime() - date1.getTime();

            

Reported by PMD.

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

    public void test_0() throws Exception {
        String text = "{ // aa" //
                      + "\n}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(0, obj.size());
    }

            

Reported by PMD.

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

Line: 17

                      String text = "{ // aa" //
                      + "\n}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(0, obj.size());
    }

    public void test_1() throws Exception {
        String text = "{ // aa" //
                      + "\n\"value\":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: 20

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

    public void test_1() throws Exception {
        String text = "{ // aa" //
                      + "\n\"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));

            

Reported by PMD.

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

Line: 24

                      String text = "{ // aa" //
                      + "\n\"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_2() throws Exception {
        String text = "{ /* aa */ \"value\":1001}";

            

Reported by PMD.

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

Line: 25

                                    + "\n\"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_2() throws Exception {
        String text = "{ /* aa */ \"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);

            

Reported by PMD.

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

Line: 25

                                    + "\n\"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_2() throws Exception {
        String text = "{ /* aa */ \"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(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: 28

                      Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_2() throws Exception {
        String text = "{ /* aa */ \"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

            

Reported by PMD.

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

Line: 31

                  public void test_2() throws Exception {
        String text = "{ /* aa */ \"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_3() throws Exception {
        String text = "{ \"value\":/* aa */1001}";

            

Reported by PMD.

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

Line: 32

                      String text = "{ /* aa */ \"value\":1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_3() throws Exception {
        String text = "{ \"value\":/* aa */1001}";
        JSONObject obj = (JSONObject) JSON.parse(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: 35

                      Assert.assertEquals(1001, obj.get("value"));
    }

    public void test_3() throws Exception {
        String text = "{ \"value\":/* aa */1001}";
        JSONObject obj = (JSONObject) JSON.parse(text);
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(1001, obj.get("value"));
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1300/Issue1330_short.java
25 issues
Do not use the short type
Performance

Line: 45

                  }

    public static class Model {
        public short 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: 11

               * Created by wenshao on 30/07/2017.
 */
public class Issue1330_short extends TestCase {
    public void test_for_issue() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
        } catch (JSONException e) {
            error = e;

            

Reported by PMD.

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

Line: 11

               * Created by wenshao on 30/07/2017.
 */
public class Issue1330_short extends TestCase {
    public void test_for_issue() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"value\":\"ABC\"}", Model.class);
        } catch (JSONException e) {
            error = e;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      } catch (JSONException e) {
            error = e;
        }
        assertNotNull(error);
        assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

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

            

Reported by PMD.

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

Line: 19

                          error = e;
        }
        assertNotNull(error);
        assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

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

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                          error = e;
        }
        assertNotNull(error);
        assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

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

            

Reported by PMD.

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

Line: 19

                          error = e;
        }
        assertNotNull(error);
        assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

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

            

Reported by PMD.

Use assertSame(x, y) instead of assertTrue(x==y), or assertNotSame(x,y) vs assertFalse(x==y)
Design

Line: 19

                          error = e;
        }
        assertNotNull(error);
        assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

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

            

Reported by PMD.

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

Line: 22

                      assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

    public void test_for_issue_1() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"value\":[]}", Model.class);
        } catch (JSONException e) {
            error = e;

            

Reported by PMD.

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

Line: 22

                      assertTrue(error.getMessage().indexOf("parseShort error, field : value") != -1);
    }

    public void test_for_issue_1() throws Exception {
        Exception error = null;
        try {
            JSON.parseObject("{\"value\":[]}", Model.class);
        } catch (JSONException e) {
            error = e;

            

Reported by PMD.

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

Line: 19

                  public static void main(String[] args) throws Exception {
        Result result = JUnitCore.runClasses(Bug_for_Next.class);
        for (Failure fail : result.getFailures()) {
            System.out.println(fail.toString());
        }
        if (result.wasSuccessful()) {
            System.out.println("All tests finished successfully...");
        }
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 22

                          System.out.println(fail.toString());
        }
        if (result.wasSuccessful()) {
            System.out.println("All tests finished successfully...");
        }
    }

    public void testPrimitiveArray() throws Exception {


            

Reported by PMD.

System.out.println is used
Design

Line: 183

                  }

    private void showTitle(String title) {
        System.out.println("test " + title);
    }

    private void showMesg(String mesg) {
        System.out.println("  " + mesg);
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 187

                  }

    private void showMesg(String mesg) {
        System.out.println("  " + mesg);
    }

    private static String byteArrayToHexString(byte[] data) {
        return byteArrayToHexString(data, 0, data.length);
    }

            

Reported by PMD.

Avoid reassigning parameters such as 'offest'
Design

Line: 194

                      return byteArrayToHexString(data, 0, data.length);
    }

    private static String byteArrayToHexString(byte[] data, int offest, int len) {
        if (data == null) {
            return "";
        }

        StringBuilder sb = new StringBuilder();

            

Reported by PMD.

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

Line: 16

              
public class Bug_for_Next extends TestCase {

    public static void main(String[] args) throws Exception {
        Result result = JUnitCore.runClasses(Bug_for_Next.class);
        for (Failure fail : result.getFailures()) {
            System.out.println(fail.toString());
        }
        if (result.wasSuccessful()) {

            

Reported by PMD.

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

Line: 21

                      for (Failure fail : result.getFailures()) {
            System.out.println(fail.toString());
        }
        if (result.wasSuccessful()) {
            System.out.println("All tests finished successfully...");
        }
    }

    public void testPrimitiveArray() throws Exception {

            

Reported by PMD.

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

Line: 26

                      }
    }

    public void testPrimitiveArray() throws Exception {

        showTitle("1=====================================");
        String text= JSON.toJSONString("testbytearray".getBytes());
        showMesg("text : " + text);
        byte[] byteArray = JSON.parseObject(text, byte[].class);

            

Reported by PMD.

The method 'testPrimitiveArray()' has a NCSS line count of 127.
Design

Line: 26

                      }
    }

    public void testPrimitiveArray() throws Exception {

        showTitle("1=====================================");
        String text= JSON.toJSONString("testbytearray".getBytes());
        showMesg("text : " + text);
        byte[] byteArray = JSON.parseObject(text, byte[].class);

            

Reported by PMD.

The method testPrimitiveArray() has an NCSS line count of 127
Design

Line: 26

                      }
    }

    public void testPrimitiveArray() throws Exception {

        showTitle("1=====================================");
        String text= JSON.toJSONString("testbytearray".getBytes());
        showMesg("text : " + text);
        byte[] byteArray = JSON.parseObject(text, byte[].class);

            

Reported by PMD.

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

    public void test_utf() throws Exception {
        JSONObject obj = (JSONObject) JSON.parse("{'name':'刘大'}".getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals("刘大", obj.get("name"));
    }


            

Reported by PMD.

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

Line: 12

              public class TestUTF8 extends TestCase {

    public void test_utf() throws Exception {
        JSONObject obj = (JSONObject) JSON.parse("{'name':'刘大'}".getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals("刘大", obj.get("name"));
    }

    public void test_utf_cn() throws Exception {

            

Reported by PMD.

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

Line: 13

              
    public void test_utf() throws Exception {
        JSONObject obj = (JSONObject) JSON.parse("{'name':'刘大'}".getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals("刘大", obj.get("name"));
    }

    public void test_utf_cn() throws Exception {
        String content = "首先来到村委会,走进农家书屋,认真翻看各种图书和报刊。他拿起一份藏文版《人民日报》,询问村民读书读报的情况,并和正在读书的几位藏族青年亲切交谈,勉励他们好好学习,学以致用,培养致富本领。在党支部活动室,村支部书记桑杰介绍了支部建设情况。当听到全村36名党员发挥先锋模范作用";

            

Reported by PMD.

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

Line: 14

                  public void test_utf() throws Exception {
        JSONObject obj = (JSONObject) JSON.parse("{'name':'刘大'}".getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals("刘大", obj.get("name"));
    }

    public void test_utf_cn() throws Exception {
        String content = "首先来到村委会,走进农家书屋,认真翻看各种图书和报刊。他拿起一份藏文版《人民日报》,询问村民读书读报的情况,并和正在读书的几位藏族青年亲切交谈,勉励他们好好学习,学以致用,培养致富本领。在党支部活动室,村支部书记桑杰介绍了支部建设情况。当听到全村36名党员发挥先锋模范作用";
        JSONObject json = 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: 17

                      Assert.assertEquals("刘大", obj.get("name"));
    }

    public void test_utf_cn() throws Exception {
        String content = "首先来到村委会,走进农家书屋,认真翻看各种图书和报刊。他拿起一份藏文版《人民日报》,询问村民读书读报的情况,并和正在读书的几位藏族青年亲切交谈,勉励他们好好学习,学以致用,培养致富本领。在党支部活动室,村支部书记桑杰介绍了支部建设情况。当听到全村36名党员发挥先锋模范作用";
        JSONObject json = new JSONObject();
        json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());

            

Reported by PMD.

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

Line: 20

                  public void test_utf_cn() throws Exception {
        String content = "首先来到村委会,走进农家书屋,认真翻看各种图书和报刊。他拿起一份藏文版《人民日报》,询问村民读书读报的情况,并和正在读书的几位藏族青年亲切交谈,勉励他们好好学习,学以致用,培养致富本领。在党支部活动室,村支部书记桑杰介绍了支部建设情况。当听到全村36名党员发挥先锋模范作用";
        JSONObject json = new JSONObject();
        json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(content, obj.get("content"));
    }


            

Reported by PMD.

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

Line: 21

                      String content = "首先来到村委会,走进农家书屋,认真翻看各种图书和报刊。他拿起一份藏文版《人民日报》,询问村民读书读报的情况,并和正在读书的几位藏族青年亲切交谈,勉励他们好好学习,学以致用,培养致富本领。在党支部活动室,村支部书记桑杰介绍了支部建设情况。当听到全村36名党员发挥先锋模范作用";
        JSONObject json = new JSONObject();
        json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(content, obj.get("content"));
    }

    public void test_utf_de() throws Exception {

            

Reported by PMD.

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

Line: 22

                      JSONObject json = new JSONObject();
        json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(content, obj.get("content"));
    }

    public void test_utf_de() throws Exception {
        String content = "Beim Griechenland-Gipfel gibt es viele Gewinner. Kanzlerin Merkel bekommt die Bankenbeteiligung, Frankreichs Präsident Sarkozy den Aufkauf von Staatsanleihen. \\nEinzig EZB-Präsident Jean-Claude Trichet gilt als Verlierer. Er zog im Machtkampf den Kürzeren";

            

Reported by PMD.

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

Line: 23

                      json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());
        Assert.assertEquals(content, obj.get("content"));
    }

    public void test_utf_de() throws Exception {
        String content = "Beim Griechenland-Gipfel gibt es viele Gewinner. Kanzlerin Merkel bekommt die Bankenbeteiligung, Frankreichs Präsident Sarkozy den Aufkauf von Staatsanleihen. \\nEinzig EZB-Präsident Jean-Claude Trichet gilt als Verlierer. Er zog im Machtkampf den Kürzeren";
        JSONObject json = 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(content, obj.get("content"));
    }

    public void test_utf_de() throws Exception {
        String content = "Beim Griechenland-Gipfel gibt es viele Gewinner. Kanzlerin Merkel bekommt die Bankenbeteiligung, Frankreichs Präsident Sarkozy den Aufkauf von Staatsanleihen. \\nEinzig EZB-Präsident Jean-Claude Trichet gilt als Verlierer. Er zog im Machtkampf den Kürzeren";
        JSONObject json = new JSONObject();
        json.put("content", content);
        JSONObject obj = (JSONObject) JSON.parse(json.toJSONString().getBytes("UTF-8"));
        Assert.assertEquals(1, obj.size());

            

Reported by PMD.