The following issues were found

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

              import com.alibaba.fastjson.serializer.SerializeWriter;

public class SerializeWriterTest_14 extends TestCase {
    @SuppressWarnings("rawtypes")
    public void test_writer_1() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);

        try {

            

Reported by PMD.

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

Line: 32

                  }
    
    
    public void test_writer_2() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);

        try {
            JSONSerializer serializer = new JSONSerializer(out);

            

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("{ab:\"a\"}", strOut.toString());
    }
    
    public void test_writer_3() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);

        try {
            JSONSerializer serializer = new JSONSerializer(out);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_15.java
3 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: 16

              import com.alibaba.fastjson.serializer.SerializerFeature;

public class SerializeWriterTest_15 extends TestCase {
    @SuppressWarnings("rawtypes")
    public void test_writer_1() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);
        out.config(SerializerFeature.UseSingleQuotes, true);


            

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

                  }
    
    
    public void test_writer_2() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);
        out.config(SerializerFeature.UseSingleQuotes, true);

        try {

            

Reported by PMD.

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

Line: 50

                      Assert.assertEquals("{ab:'a'}", strOut.toString());
    }
    
    public void test_writer_3() throws Exception {
        StringWriter strOut = new StringWriter();
        SerializeWriter out = new SerializeWriter(strOut, 1);
        out.config(SerializerFeature.UseSingleQuotes, true);

        try {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/deny/DenyTest3.java
3 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: 16

              
public class DenyTest3 extends TestCase {

    public void test_0() throws Exception {
        String text = "{}";

        ParserConfig config = new ParserConfig();

        Properties properties = new Properties();

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.json.bvtVO.deny.A'
Design

Line: 10

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.json.bvtVO.deny.A;

import junit.framework.TestCase;

public class DenyTest3 extends TestCase {


            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '25'-'29').
Error

Line: 25

                      properties.put(ParserConfig.DENY_PROPERTY, "com.alibaba.json.bvtVO.deny,,aa");
        config.configFromPropety(properties);
        
        Exception error = null;
        try {
            JSON.parseObject("{\"@type\":\"com.alibaba.json.bvtVO.deny$A\"}", Object.class, config, JSON.DEFAULT_PARSER_FEATURE);
        } catch (JSONException ex) {
            error = ex;
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumUsingToString.java
3 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

               * Created by wenshao on 17/03/2017.
 */
public class EnumUsingToString extends TestCase {
    public void test_toString() {
        Model model = new Model();
        model.gender = Gender.M;

        String text = JSON.toJSONString(model);
        assertEquals("{\"gender\":\"男\"}", text);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      model.gender = Gender.M;

        String text = JSON.toJSONString(model);
        assertEquals("{\"gender\":\"男\"}", text);
    }

    public static class Model {
        @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
        public Gender gender;

            

Reported by PMD.

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

Line: 22

              
    public static class Model {
        @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
        public Gender gender;
    }

    public static enum Gender {
        M("男"),
        W("女");

            

Reported by PMD.

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

    public void test_file() throws Exception {
        char ch = 'a';
        
        String text = JSON.toJSONString(ch);
        
        Assert.assertEquals("\"a\"", text);

            

Reported by PMD.

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

Line: 21

                      Character c1 = JSON.parseObject(text, Character.class);
        Character c2 = JSON.parseObject(text, char.class);
        
        Assert.assertEquals(ch, c1.charValue());
        Assert.assertEquals(ch, c2.charValue());
                
    }
}

            

Reported by PMD.

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

Line: 22

                      Character c2 = JSON.parseObject(text, char.class);
        
        Assert.assertEquals(ch, c1.charValue());
        Assert.assertEquals(ch, c2.charValue());
                
    }
}

            

Reported by PMD.

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

    public void test_obj() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"id\":123}"));

        reader.startObject();
        Assert.assertEquals("id", reader.readString());
        Assert.assertEquals(Integer.valueOf(123), reader.readInteger());

            

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

                      reader.close();
    }

    public void test_obj_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"val\":{\"id\":123}}"));

        reader.startObject();

        Assert.assertEquals("val", reader.readString());

            

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

                      reader.close();
    }
    
    public void test_obj_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"val\":{\"val\":{\"id\":123}}}"));

        reader.startObject();
        Assert.assertEquals("val", reader.readString());
        

            

Reported by PMD.

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

    public void test_model() throws Exception {
        Model model = new Model();
        model.value = true;
        
        String text = JSON.toJSONString(model);
        Assert.assertEquals("{\"value\":true}", 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: 19

                      Assert.assertEquals("{\"value\":true}", text);
    }
    
    public void test_model_max() throws Exception {
        Model model = new Model();
        model.value = false;
        
        String text = JSON.toJSONString(model);
        Assert.assertEquals("{\"value\":false}", text);

            

Reported by PMD.

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

Line: 29

              
    public static class Model {

        public boolean value;
    }
}

            

Reported by PMD.

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

    public void test_enums() throws Exception {
        Entity a = JSON.parseObject("{units:['NANOSECONDS', 'SECONDS', 3, null]}", Entity.class);
        Assert.assertEquals(TimeUnit.NANOSECONDS, a.getUnits().get(0));
    }

    public static class Entity {

            

Reported by PMD.

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

Line: 16

              
    public void test_enums() throws Exception {
        Entity a = JSON.parseObject("{units:['NANOSECONDS', 'SECONDS', 3, null]}", Entity.class);
        Assert.assertEquals(TimeUnit.NANOSECONDS, a.getUnits().get(0));
    }

    public static class Entity {

        private List<TimeUnit> units = new ArrayList<TimeUnit>();

            

Reported by PMD.

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

Line: 16

              
    public void test_enums() throws Exception {
        Entity a = JSON.parseObject("{units:['NANOSECONDS', 'SECONDS', 3, null]}", Entity.class);
        Assert.assertEquals(TimeUnit.NANOSECONDS, a.getUnits().get(0));
    }

    public static class Entity {

        private List<TimeUnit> units = new ArrayList<TimeUnit>();

            

Reported by PMD.

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

Line: 26

                      Assert.assertNotNull(first);
        Assert.assertNotNull(second);

        Assert.assertEquals(new Integer(3), reader.readInteger());
        Assert.assertNull(reader.readString());
        
        {
            Map<String, Object> map = new HashMap<String, Object>();
            reader.readObject(map);

            

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

              
public class JSONReader_array extends TestCase {

    public void test_array() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[],[],3,null,{\"name\":\"jobs\"},{\"id\":123},{\"id\":1},{\"id\":2}]"));
        reader.startArray();

        JSONArray first = (JSONArray) reader.readObject();
        JSONArray second = (JSONArray) reader.readObject();

            

Reported by PMD.

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

Line: 38

                      {
            VO vo = new VO();
            reader.readObject(vo);
            Assert.assertEquals(123, vo.getId());
        }
        
        while (reader.hasNext()) {
            VO vo = reader.readObject(VO.class);
            Assert.assertNotNull(vo);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest5.java
3 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

              
public class RefTest5 extends TestCase {
    
    public void test_ref() throws Exception {
        Object[] array = new Object[1];
        array[0] = new Object[] { array };
        Assert.assertEquals("[[{\"$ref\":\"..\"}]]", JSON.toJSONString(array));
    }
    

            

Reported by PMD.

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

Line: 18

                      Assert.assertEquals("[[{\"$ref\":\"..\"}]]", JSON.toJSONString(array));
    }
    
    public void test_parse() throws Exception {
        Object[] array2 = JSON.parseObject("[[{\"$ref\":\"..\"}]]", Object[].class);
        JSONArray item = (JSONArray) array2[0];
        Assert.assertSame(item, item.get(0));
    }
    

            

Reported by PMD.

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

Line: 21

                  public void test_parse() throws Exception {
        Object[] array2 = JSON.parseObject("[[{\"$ref\":\"..\"}]]", Object[].class);
        JSONArray item = (JSONArray) array2[0];
        Assert.assertSame(item, item.get(0));
    }
    
}

            

Reported by PMD.