The following issues were found

src/test/java/com/alibaba/json/bvt/serializer/MultiFieldIntTest_writer.java
6 issues
System.out.println is used
Design

Line: 32

                      writer.close();
        
        String text = out.toString();
        System.out.println(text);
        List<Model> results = JSON.parseObject(text, new TypeReference<List<Model>>() {});
        
        Assert.assertEquals(list.size(), results.size());
        for (int i = 0; i < results.size(); ++i) {
            Assert.assertEquals(list.get(i).id, results.get(i).id);

            

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

              
public class MultiFieldIntTest_writer extends TestCase {
    
    public void test_for_big_writer() throws Exception {
        List<Model> list = new ArrayList<Model>();
        
        for (int i = 0; i < 1024 * 10; ++i) {
            Model model = new Model();
            model.id = 10000000 + i;

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 21

                      List<Model> list = new ArrayList<Model>();
        
        for (int i = 0; i < 1024 * 10; ++i) {
            Model model = new Model();
            model.id = 10000000 + i;
            list.add(model);
        }
        
        StringWriter out = new StringWriter();

            

Reported by PMD.

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

Line: 37

                      
        Assert.assertEquals(list.size(), results.size());
        for (int i = 0; i < results.size(); ++i) {
            Assert.assertEquals(list.get(i).id, results.get(i).id);
        }
    }
    
    public static class Model {
        public int id;

            

Reported by PMD.

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

Line: 37

                      
        Assert.assertEquals(list.size(), results.size());
        for (int i = 0; i < results.size(); ++i) {
            Assert.assertEquals(list.get(i).id, results.get(i).id);
        }
    }
    
    public static class Model {
        public int id;

            

Reported by PMD.

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

Line: 42

                  }
    
    public static class Model {
        public int id;
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/ListSerializerTest3.java
6 issues
System.out.println is used
Design

Line: 27

                      listSerializer.write(new JSONSerializer(out), list, null, null, 0);
        long end = System.currentTimeMillis();

        System.out.println("arrayList time: " + (end - start));
    }

    public void test_2() throws Exception {
        SerializeWriter out = new SerializeWriter();


            

Reported by PMD.

System.out.println is used
Design

Line: 44

                      listSerializer.write(new JSONSerializer(out), list, null, null, 0);
        long end = System.currentTimeMillis();

        System.out.println("linkedList time: " + (end - start));
    }

}

            

Reported by PMD.

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

Line: 14

              
public class ListSerializerTest3 extends TestCase {

    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter();
        ListSerializer listSerializer = new ListSerializer();

        ArrayList<Object> list = new ArrayList<Object>();
        for (int i = 0; i < 100000; i++) {

            

Reported by PMD.

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

Line: 14

              
public class ListSerializerTest3 extends TestCase {

    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter();
        ListSerializer listSerializer = new ListSerializer();

        ArrayList<Object> list = new ArrayList<Object>();
        for (int i = 0; i < 100000; i++) {

            

Reported by PMD.

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

Line: 30

                      System.out.println("arrayList time: " + (end - start));
    }

    public void test_2() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();

        LinkedList<Object> list = new LinkedList<Object>();

            

Reported by PMD.

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

Line: 30

                      System.out.println("arrayList time: " + (end - start));
    }

    public void test_2() throws Exception {
        SerializeWriter out = new SerializeWriter();

        ListSerializer listSerializer = new ListSerializer();

        LinkedList<Object> list = new LinkedList<Object>();

            

Reported by PMD.

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

Line: 14

              
public class ListFieldTest extends TestCase {

    public void test_for_list() throws Exception {
        Model model = new Model();
        model.id = 1000;
        Assert.assertEquals("{\"id\":1000,\"values\":[]}", JSON.toJSONString(model));
        
        model.values.add("1001");

            

Reported by PMD.

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

Line: 19

                      model.id = 1000;
        Assert.assertEquals("{\"id\":1000,\"values\":[]}", JSON.toJSONString(model));
        
        model.values.add("1001");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\"]}", JSON.toJSONString(model));
        
        model.values.add("1002");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\",\"1002\"]}", JSON.toJSONString(model));
        

            

Reported by PMD.

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

Line: 22

                      model.values.add("1001");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\"]}", JSON.toJSONString(model));
        
        model.values.add("1002");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\",\"1002\"]}", JSON.toJSONString(model));
        
        model.values.add("1003");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\",\"1002\",\"1003\"]}", JSON.toJSONString(model));
    }

            

Reported by PMD.

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

Line: 25

                      model.values.add("1002");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\",\"1002\"]}", JSON.toJSONString(model));
        
        model.values.add("1003");
        Assert.assertEquals("{\"id\":1000,\"values\":[\"1001\",\"1002\",\"1003\"]}", JSON.toJSONString(model));
    }

    public static class Model {


            

Reported by PMD.

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

Line: 32

                  public static class Model {

        private int          id;
        private List<String> values = new ArrayList<String>();

        public int getId() {
            return id;
        }


            

Reported by PMD.

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

Line: 32

                  public static class Model {

        private int          id;
        private List<String> values = new ArrayList<String>();

        public int getId() {
            return id;
        }


            

Reported by PMD.

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

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Long.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Long.class));

            

Reported by PMD.

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

Line: 16

              public class LongDeserializerTest extends TestCase {

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Long.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Long.class));


            

Reported by PMD.

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

Line: 17

              
    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Long.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Long.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

            

Reported by PMD.

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

Line: 18

                  public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Long.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Long.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Long.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, LongCodec.instance.deserialze(parser, null, null));

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(null, JSON.parseObject("null", Long.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, LongCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, LongCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

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

Line: 24

              
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, LongCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, LongCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/stream/JSONReaderScannerTest.java
6 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 com.alibaba.fastjson.parser.JSONReaderScanner;

public class JSONReaderScannerTest extends TestCase {
	public void test_singleQuote() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{'name':'张三\\'\\n\\r\\\"'}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}

            

Reported by PMD.

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

Line: 15

              	public void test_singleQuote() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{'name':'张三\\'\\n\\r\\\"'}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}
	
	public void test_doubleQuote() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":\"张三\\'\\n\\r\\\"\"}"));

            

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

              		parser.close();
	}
	
	public void test_doubleQuote() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":\"张三\\'\\n\\r\\\"\"}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}

            

Reported by PMD.

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

Line: 22

              	public void test_doubleQuote() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"name\":\"张三\\'\\n\\r\\\"\"}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}
	
	public void test_doubleQuote_2() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{name:\"张三\\'\\n\\r\\\"\"}"));

            

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

              		parser.close();
	}
	
	public void test_doubleQuote_2() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{name:\"张三\\'\\n\\r\\\"\"}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}

            

Reported by PMD.

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

Line: 29

              	public void test_doubleQuote_2() throws Exception {
		DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{name:\"张三\\'\\n\\r\\\"\"}"));
		JSONObject json = parser.parseObject();
		Assert.assertEquals("张三\'\n\r\"", json.get("name"));
		parser.close();
	}
}

            

Reported by PMD.

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

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Integer.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Integer.class));

            

Reported by PMD.

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

Line: 16

              public class IntegerDeserializerTest extends TestCase {

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Integer.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Integer.class));


            

Reported by PMD.

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

Line: 17

              
    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Integer.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Integer.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

            

Reported by PMD.

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

Line: 18

                  public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Integer.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Integer.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Integer.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, IntegerCodec.instance.deserialze(parser, null, null));

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(null, JSON.parseObject("null", Integer.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, IntegerCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, IntegerCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

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

Line: 24

              
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, IntegerCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, IntegerCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 01/04/2017.
 */
public class NotWriteDefaultValueFieldTest extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    public static class Model {

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 01/04/2017.
 */
public class NotWriteDefaultValueFieldTest extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

               */
public class NotWriteDefaultValueFieldTest extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    public static class Model {


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

              public class NotWriteDefaultValueFieldTest extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    public static class Model {

        @JSONField(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)

            

Reported by PMD.

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

Line: 21

                  public static class Model {

        @JSONField(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)
        public int id;

        public Model(int id) {
            this.id = id;
        }
    }

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.parser.Feature'
Design

Line: 5

              
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.parser.Feature;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;

/**
 * Created by wenshao on 01/04/2017.

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 01/04/2017.
 */
public class NotWriteDefaultValueFieldTest2 extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    @JSONType(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)

            

Reported by PMD.

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

Line: 13

               * Created by wenshao on 01/04/2017.
 */
public class NotWriteDefaultValueFieldTest2 extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    @JSONType(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

               */
public class NotWriteDefaultValueFieldTest2 extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    @JSONType(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)
    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

              public class NotWriteDefaultValueFieldTest2 extends TestCase {
    public void test_not_write_default() throws Exception {
        assertEquals("{}", JSON.toJSONString(new Model(0)));
        assertEquals("{\"id\":1}", JSON.toJSONString(new Model(1)));
    }

    @JSONType(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)
    public static class Model {
        public int id;

            

Reported by PMD.

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

Line: 20

              
    @JSONType(serialzeFeatures = SerializerFeature.NotWriteDefaultValue)
    public static class Model {
        public int id;

        public Model(int id) {
            this.id = id;
        }
    }

            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.serializer.features;

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

/**

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/InnerClassDeser.java
6 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 10

               * Created by wenshao on 25/03/2017.
 */
public class InnerClassDeser extends TestCase {
    public void test_for_inner_class() throws Exception {
        Model model = JSON.parseObject("{\"item\":{\"id\":123}}", Model.class);
        assertNotNull(model.item);
        assertEquals(123, model.item.id);
    }


            

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

               * Created by wenshao on 25/03/2017.
 */
public class InnerClassDeser extends TestCase {
    public void test_for_inner_class() throws Exception {
        Model model = JSON.parseObject("{\"item\":{\"id\":123}}", Model.class);
        assertNotNull(model.item);
        assertEquals(123, model.item.id);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class InnerClassDeser extends TestCase {
    public void test_for_inner_class() throws Exception {
        Model model = JSON.parseObject("{\"item\":{\"id\":123}}", Model.class);
        assertNotNull(model.item);
        assertEquals(123, model.item.id);
    }

    public static class Model {
        public Item item;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_for_inner_class() throws Exception {
        Model model = JSON.parseObject("{\"item\":{\"id\":123}}", Model.class);
        assertNotNull(model.item);
        assertEquals(123, model.item.id);
    }

    public static class Model {
        public Item item;


            

Reported by PMD.

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

Line: 17

                  }

    public static class Model {
        public Item item;

        public class Item {
            public int id;
        }
    }

            

Reported by PMD.

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

Line: 20

                      public Item item;

        public class Item {
            public int id;
        }
    }
}

            

Reported by PMD.

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

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Float.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Float.class));

            

Reported by PMD.

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

Line: 16

              public class FloatDeserializerTest extends TestCase {

    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Float.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Float.class));


            

Reported by PMD.

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

Line: 17

              
    public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Float.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Float.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);

            

Reported by PMD.

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

Line: 18

                  public void test_bigdecimal() throws Exception {
        Assert.assertEquals(0, JSON.parseObject("0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("0.0", Float.class).intValue());
        Assert.assertEquals(0, JSON.parseObject("'0'", Float.class).intValue());

        Assert.assertEquals(null, JSON.parseObject("null", Float.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, FloatCodec.instance.deserialze(parser, null, null));

            

Reported by PMD.

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

Line: 23

                      Assert.assertEquals(null, JSON.parseObject("null", Float.class));

        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, FloatCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, FloatCodec.instance.getFastMatchToken());
    }
}


            

Reported by PMD.

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

Line: 24

              
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, FloatCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_INT, FloatCodec.instance.getFastMatchToken());
    }
}


            

Reported by PMD.