The following issues were found

src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_float.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

              import junit.framework.TestCase;

public class ArrayMapping_float extends TestCase {
    public void test_float() throws Exception {
        Model model = JSON.parseObject("[123.45,\"wenshao\"]", Model.class, Feature.SupportArrayToBean);
        Assert.assertTrue(123.45F == model.id);
        Assert.assertEquals("wenshao", model.name);
    }
    

            

Reported by PMD.

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

Line: 18

                  }
    
    public static class Model {
        public float id;
        public String name;
        
    }
}

            

Reported by PMD.

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

Line: 19

                  
    public static class Model {
        public float id;
        public String name;
        
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestShortField.java
3 issues
Do not use the short type
Performance

Line: 20

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

              import junit.framework.TestCase;

public class WriteNonStringValueAsStringTestShortField extends TestCase {
    public void test_0() throws Exception {
        VO vo = new VO();
        vo.id = 100;
        
        String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
        Assert.assertEquals("{\"id\":\"100\"}", text);

            

Reported by PMD.

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

Line: 20

                  }
    
    public static class VO {
        public short id;
    }
}

            

Reported by PMD.

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

              
public class SerializeConfigTest2 extends TestCase {

    public void test_1() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setTypeKey("%type");
        Assert.assertEquals("%type", config.getTypeKey());
        
        Model model = new Model();

            

Reported by PMD.

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

Line: 28

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

            

Reported by PMD.

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

Line: 3

              package com.alibaba.json.bvt.serializer;

import java.util.LinkedHashMap;

import org.junit.Assert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;

            

Reported by PMD.

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

              
public class SerializeConfigTest2_private extends TestCase {

    public void test_1() throws Exception {
        SerializeConfig config = new SerializeConfig();
        config.setTypeKey("%type");
        Assert.assertEquals("%type", config.getTypeKey());
        
        Model model = new Model();

            

Reported by PMD.

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

Line: 28

                  }
    
    private static class Model {
        public int value;
    }
}

            

Reported by PMD.

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

Line: 3

              package com.alibaba.json.bvt.serializer;

import java.util.LinkedHashMap;

import org.junit.Assert;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/TreeMapDeserializerTest.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

              import com.alibaba.fastjson.JSON;

public class TreeMapDeserializerTest extends TestCase {
    public void test_0 () throws Exception {
        TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
        Assert.assertEquals(0, treeMap.size());
    }
}

            

Reported by PMD.

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

Line: 12

              
public class TreeMapDeserializerTest extends TestCase {
    public void test_0 () throws Exception {
        TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
        Assert.assertEquals(0, treeMap.size());
    }
}

            

Reported by PMD.

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

Line: 13

              public class TreeMapDeserializerTest extends TestCase {
    public void test_0 () throws Exception {
        TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
        Assert.assertEquals(0, treeMap.size());
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_long.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

              import junit.framework.TestCase;

public class ArrayMapping_long extends TestCase {
    public void test_for_error() throws Exception {
        Model model = JSON.parseObject("[1001,\"wenshao\"]", Model.class, Feature.SupportArrayToBean);
        Assert.assertEquals(1001, model.id);
        Assert.assertEquals("wenshao", model.name);
    }
    

            

Reported by PMD.

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

Line: 18

                  }
    
    public static class Model {
        public long id;
        public String name;
        
    }
}

            

Reported by PMD.

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

Line: 19

                  
    public static class Model {
        public long id;
        public String name;
        
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/TimeZoneDeserializerTest.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

              import junit.framework.TestCase;

public class TimeZoneDeserializerTest extends TestCase {
    public void test_timezone() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

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

Line: 16

              public class TimeZoneDeserializerTest extends TestCase {
    public void test_timezone() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

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

Line: 17

                  public void test_timezone() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
        Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
        Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
    }
}

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_long_stream.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

              import junit.framework.TestCase;

public class ArrayMapping_long_stream extends TestCase {
    public void test_for_error() throws Exception {
        
        JSONReader reader = new JSONReader(new StringReader("[1001,\"wenshao\"]"), Feature.SupportArrayToBean);
        Model model = reader.readObject(Model.class);
        Assert.assertEquals(1001, model.id);
        Assert.assertEquals("wenshao", model.name);

            

Reported by PMD.

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

Line: 22

                  }
    
    public static class Model {
        public long id;
        public String name;
        
    }
}

            

Reported by PMD.

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

Line: 23

                  
    public static class Model {
        public long id;
        public String name;
        
    }
}

            

Reported by PMD.

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

    public void test_erro_0() throws Exception {
        SerializeWriter out = new SerializeWriter(new ErrorWriter());
        Exception error = null;
        try {
            out.flush();
        } catch (Exception ex) {

            

Reported by PMD.

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

Line: 19

                      Exception error = null;
        try {
            out.flush();
        } catch (Exception ex) {
            error = ex;
        }
        Assert.assertNotNull(error);
        out.close();
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '16'-'20').
Error

Line: 16

              
    public void test_erro_0() throws Exception {
        SerializeWriter out = new SerializeWriter(new ErrorWriter());
        Exception error = null;
        try {
            out.flush();
        } catch (Exception ex) {
            error = ex;
        }

            

Reported by PMD.

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

    public void test_array() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[\"abc\"]"));

        reader.startArray();

        Assert.assertEquals("abc", 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: 25

                      reader.close();
    }
    
    public void test_array_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[\"abc\"]]"));

        reader.startArray();
        reader.startArray();


            

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

                      reader.close();
    }
    
    public void test_array_3() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[[\"abc\"]]]"));

        reader.startArray();
        reader.startArray();
        reader.startArray();

            

Reported by PMD.