The following issues were found

src/test/java/com/alibaba/json/bvt/issue_3300/Issue3352.java
16 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: 10

              import java.util.UUID;

public class Issue3352 extends TestCase {
    public void test_for_issue() throws Exception {
        UUID uuid = UUID.randomUUID();

        JSONObject object = new JSONObject();
        Map map = object.getInnerMap();
        map.put("1", "1");

            

Reported by PMD.

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

Line: 10

              import java.util.UUID;

public class Issue3352 extends TestCase {
    public void test_for_issue() throws Exception {
        UUID uuid = UUID.randomUUID();

        JSONObject object = new JSONObject();
        Map map = object.getInnerMap();
        map.put("1", "1");

            

Reported by PMD.

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

Line: 15

              
        JSONObject object = new JSONObject();
        Map map = object.getInnerMap();
        map.put("1", "1");
        map.put("A", "A");
        map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));

            

Reported by PMD.

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

Line: 16

                      JSONObject object = new JSONObject();
        Map map = object.getInnerMap();
        map.put("1", "1");
        map.put("A", "A");
        map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));

            

Reported by PMD.

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

Line: 17

                      Map map = object.getInnerMap();
        map.put("1", "1");
        map.put("A", "A");
        map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));

            

Reported by PMD.

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

Line: 18

                      map.put("1", "1");
        map.put("A", "A");
        map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));
        assertTrue(object.containsKey("A"));

            

Reported by PMD.

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

Line: 18

                      map.put("1", "1");
        map.put("A", "A");
        map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));
        assertTrue(object.containsKey("A"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      map.put("true", "true");
        map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));
        assertTrue(object.containsKey("A"));
        assertTrue(object.containsKey(true));
        assertTrue(object.containsKey("true"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 21

                      map.put(uuid.toString(), uuid);

        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));
        assertTrue(object.containsKey("A"));
        assertTrue(object.containsKey(true));
        assertTrue(object.containsKey("true"));
        assertTrue(object.containsKey(uuid));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

              
        assertTrue(object.containsKey(1));
        assertTrue(object.containsKey("1"));
        assertTrue(object.containsKey('A'));
        assertTrue(object.containsKey("A"));
        assertTrue(object.containsKey(true));
        assertTrue(object.containsKey("true"));
        assertTrue(object.containsKey(uuid));
        assertTrue(object.containsKey(uuid.toString()));

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/parser/deserializer/OptionalCodec.java
16 issues
Avoid reassigning parameters such as 'type'
Design

Line: 22

                  public static OptionalCodec instance = new OptionalCodec();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
        
        if (type == OptionalInt.class) {
            Object obj = parser.parseObject(Integer.class);
            Integer value = TypeUtils.castToInt(obj);
            if (value == null) {

            

Reported by PMD.

The class 'OptionalCodec' has a Modified Cyclomatic Complexity of 7 (Highest = 10).
Design

Line: 17

              import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.util.TypeUtils;

public class OptionalCodec implements ObjectSerializer, ObjectDeserializer {

    public static OptionalCodec instance = new OptionalCodec();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {

            

Reported by PMD.

The class 'OptionalCodec' has a Standard Cyclomatic Complexity of 7 (Highest = 10).
Design

Line: 17

              import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.util.TypeUtils;

public class OptionalCodec implements ObjectSerializer, ObjectDeserializer {

    public static OptionalCodec instance = new OptionalCodec();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type type, Object fieldName) {

            

Reported by PMD.

The method 'write' has a Modified Cyclomatic Complexity of 10.
Design

Line: 68

                      return JSONToken.LBRACE;
    }

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
                      int features) throws IOException {

        if (object == null) {
            serializer.writeNull();
            return;

            

Reported by PMD.

The method 'write' has a Standard Cyclomatic Complexity of 10.
Design

Line: 68

                      return JSONToken.LBRACE;
    }

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
                      int features) throws IOException {

        if (object == null) {
            serializer.writeNull();
            return;

            

Reported by PMD.

The method 'write(JSONSerializer, Object, Object, Type, int)' has a cyclomatic complexity of 11.
Design

Line: 68

                      return JSONToken.LBRACE;
    }

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
                      int features) throws IOException {

        if (object == null) {
            serializer.writeNull();
            return;

            

Reported by PMD.

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

Line: 78

              
        if (object instanceof Optional) {
            Optional<?> optional = (Optional<?>) object;
            Object value = optional.isPresent() ? optional.get() : null;
            serializer.write(value);
            return;
        }

        if (object instanceof OptionalDouble) {

            

Reported by PMD.

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

Line: 78

              
        if (object instanceof Optional) {
            Optional<?> optional = (Optional<?>) object;
            Object value = optional.isPresent() ? optional.get() : null;
            serializer.write(value);
            return;
        }

        if (object instanceof OptionalDouble) {

            

Reported by PMD.

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

Line: 85

              
        if (object instanceof OptionalDouble) {
            OptionalDouble optional = (OptionalDouble) object;
            if (optional.isPresent()) {
                double value = optional.getAsDouble();
                serializer.write(value);
            } else {
                serializer.writeNull();
            }

            

Reported by PMD.

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

Line: 86

                      if (object instanceof OptionalDouble) {
            OptionalDouble optional = (OptionalDouble) object;
            if (optional.isPresent()) {
                double value = optional.getAsDouble();
                serializer.write(value);
            } else {
                serializer.writeNull();
            }
            return;

            

Reported by PMD.

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

Line: 18

                      Assert.assertEquals('\0', vo.getValue().charAt(0));
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u0000\\u0000\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\0\0", vo2.getValue());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 32

                      Assert.assertEquals('\1', vo.getValue().charAt(0));
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u0001\\u0001\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\1\1", vo2.getValue());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 46

                      Assert.assertEquals('\u2028', vo.getValue().charAt(0));
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u2028\\u2028\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\u2028\u2028", vo2.getValue());
    }

            

Reported by PMD.

System.out.println is used
Design

Line: 60

                      Assert.assertEquals('\u2029', vo.getValue().charAt(0));

        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u2029\\u2029\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\u2029\u2029", vo2.getValue());
    }

            

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

              
public class Bug_for_huling extends TestCase {

    public void test_for_0() throws Exception {
        VO vo = new VO();
        vo.setValue("\0\0");
        
        Assert.assertEquals('\0', vo.getValue().charAt(0));
        

            

Reported by PMD.

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

Line: 15

                      VO vo = new VO();
        vo.setValue("\0\0");
        
        Assert.assertEquals('\0', vo.getValue().charAt(0));
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u0000\\u0000\"}", text);


            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals("{\"value\":\"\\u0000\\u0000\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\0\0", vo2.getValue());
    }
    
    public void test_for_1() throws Exception {
        VO vo = new VO();
        vo.setValue("\1\1");

            

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

                      Assert.assertEquals("\0\0", vo2.getValue());
    }
    
    public void test_for_1() throws Exception {
        VO vo = new VO();
        vo.setValue("\1\1");
        
        Assert.assertEquals('\1', vo.getValue().charAt(0));
        

            

Reported by PMD.

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

Line: 29

                      VO vo = new VO();
        vo.setValue("\1\1");
        
        Assert.assertEquals('\1', vo.getValue().charAt(0));
        
        String text = JSON.toJSONString(vo);
        System.out.println(text);
        Assert.assertEquals("{\"value\":\"\\u0001\\u0001\"}", text);


            

Reported by PMD.

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

Line: 36

                      Assert.assertEquals("{\"value\":\"\\u0001\\u0001\"}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals("\1\1", vo2.getValue());
    }
    
    public void test_for_2028() throws Exception {
        VO vo = new VO();
        vo.setValue("\u2028\u2028");

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/path/DLATest_0.java
16 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 java.io.InputStreamReader;

public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");

            

Reported by PMD.

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

Line: 13

              import java.io.InputStreamReader;

public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");

            

Reported by PMD.

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

Line: 14

              
public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");
        assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));

            

Reported by PMD.

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

Line: 14

              
public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");
        assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));

            

Reported by PMD.

Ensure that resources like this InputStream object are closed after use
Error

Line: 14

              
public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");
        assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));

            

Reported by PMD.

Ensure that resources like this InputStream object are closed after use
Error

Line: 15

              public class DLATest_0 extends TestCase {
    public void test_dla() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");
        assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      String json = IOUtils.readAll(reader);
        Object object = JSON.parse(json, Feature.IgnoreAutoType, Feature.OrderedField);
        Object result = JSONPath.eval(object, "$..elapsedTime");
        assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));

        Object result2 = JSONPath.eval(object, "$..self");
        assertEquals("[\"http://172.17.246.55:10001/v1/query/20181024_040507_3_f32vb\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.0\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.0.0?shufferNettyServerPort=39524&commandNettyServerPort=37207\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.1\",\"http://172.17.246.55:14005/v1/task/20181024_040507_3_f32vb.1.0?shufferNettyServerPort=33921&commandNettyServerPort=45121\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.1.1?shufferNettyServerPort=39524&commandNettyServerPort=37207\"]", JSON.toJSONString(result2));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      assertEquals("[\"1.48s\",1031,1031,1005,1005,1011,1011]", JSON.toJSONString(result));

        Object result2 = JSONPath.eval(object, "$..self");
        assertEquals("[\"http://172.17.246.55:10001/v1/query/20181024_040507_3_f32vb\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.0\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.0.0?shufferNettyServerPort=39524&commandNettyServerPort=37207\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.1\",\"http://172.17.246.55:14005/v1/task/20181024_040507_3_f32vb.1.0?shufferNettyServerPort=33921&commandNettyServerPort=45121\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.1.1?shufferNettyServerPort=39524&commandNettyServerPort=37207\"]", JSON.toJSONString(result2));
    }

    public void test_dla_extract() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);

            

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("[\"http://172.17.246.55:10001/v1/query/20181024_040507_3_f32vb\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.0\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.0.0?shufferNettyServerPort=39524&commandNettyServerPort=37207\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.1\",\"http://172.17.246.55:14005/v1/task/20181024_040507_3_f32vb.1.0?shufferNettyServerPort=33921&commandNettyServerPort=45121\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.1.1?shufferNettyServerPort=39524&commandNettyServerPort=37207\"]", JSON.toJSONString(result2));
    }

    public void test_dla_extract() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);

        Object result = JSONPath.extract(json, "$..elapsedTime");

            

Reported by PMD.

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

Line: 25

                      assertEquals("[\"http://172.17.246.55:10001/v1/query/20181024_040507_3_f32vb\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.0\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.0.0?shufferNettyServerPort=39524&commandNettyServerPort=37207\",\"http://172.17.246.55:10001/v1/stage/20181024_040507_3_f32vb.1\",\"http://172.17.246.55:14005/v1/task/20181024_040507_3_f32vb.1.0?shufferNettyServerPort=33921&commandNettyServerPort=45121\",\"http://172.17.246.56:14005/v1/task/20181024_040507_3_f32vb.1.1?shufferNettyServerPort=39524&commandNettyServerPort=37207\"]", JSON.toJSONString(result2));
    }

    public void test_dla_extract() throws Exception {
        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("json/dla_01.json");
        InputStreamReader reader = new InputStreamReader(is);
        String json = IOUtils.readAll(reader);

        Object result = JSONPath.extract(json, "$..elapsedTime");

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2600/Issue2628.java
16 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: 9

              import java.math.BigInteger;

public class Issue2628 extends TestCase {
    public void test_for_issue() throws Exception {
        long MAX_LONG = Long.MAX_VALUE; //9223372036854775807
        long MIN_LONG = Long.MIN_VALUE; //-9223372036854775808

        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题

            

Reported by PMD.

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

Line: 9

              import java.math.BigInteger;

public class Issue2628 extends TestCase {
    public void test_for_issue() throws Exception {
        long MAX_LONG = Long.MAX_VALUE; //9223372036854775807
        long MIN_LONG = Long.MIN_VALUE; //-9223372036854775808

        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题

            

Reported by PMD.

Avoid unused local variables such as 'MAX_LONG'.
Design

Line: 10

              
public class Issue2628 extends TestCase {
    public void test_for_issue() throws Exception {
        long MAX_LONG = Long.MAX_VALUE; //9223372036854775807
        long MIN_LONG = Long.MIN_VALUE; //-9223372036854775808

        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题
        assertEquals("9423372036854775807", bi1.toString());

            

Reported by PMD.

Avoid unused local variables such as 'MIN_LONG'.
Design

Line: 11

              public class Issue2628 extends TestCase {
    public void test_for_issue() throws Exception {
        long MAX_LONG = Long.MAX_VALUE; //9223372036854775807
        long MIN_LONG = Long.MIN_VALUE; //-9223372036854775808

        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题
        assertEquals("9423372036854775807", bi1.toString());


            

Reported by PMD.

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

Line: 13

                      long MAX_LONG = Long.MAX_VALUE; //9223372036854775807
        long MIN_LONG = Long.MIN_VALUE; //-9223372036854775808

        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题
        assertEquals("9423372036854775807", bi1.toString());

        BigInteger bi2 = new BigInteger(s1); //没问题
        assertEquals("9423372036854775807", bi2.toString());

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

              
        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题
        assertEquals("9423372036854775807", bi1.toString());

        BigInteger bi2 = new BigInteger(s1); //没问题
        assertEquals("9423372036854775807", bi2.toString());

        Tobject tobj1 = new Tobject();

            

Reported by PMD.

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

Line: 15

              
        String s1 = "9423372036854775807"; //-9423372036854775808
        BigInteger bi1 = JSON.parseObject(s1, BigInteger.class); //没问题
        assertEquals("9423372036854775807", bi1.toString());

        BigInteger bi2 = new BigInteger(s1); //没问题
        assertEquals("9423372036854775807", bi2.toString());

        Tobject tobj1 = new Tobject();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      assertEquals("9423372036854775807", bi1.toString());

        BigInteger bi2 = new BigInteger(s1); //没问题
        assertEquals("9423372036854775807", bi2.toString());

        Tobject tobj1 = new Tobject();
        tobj1.setBi(bi2); //没问题
        assertEquals("9423372036854775807", tobj1.getBi().toString());;


            

Reported by PMD.

An empty statement (semicolon) not part of a loop
Error

Line: 22

              
        Tobject tobj1 = new Tobject();
        tobj1.setBi(bi2); //没问题
        assertEquals("9423372036854775807", tobj1.getBi().toString());;

        String s2 = JSON.toJSONString(tobj1);
        Tobject tobj2 = JSON.parseObject(s2, Tobject.class);  //有问题
        assertEquals("9423372036854775807", tobj2.getBi().toString());
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

              
        Tobject tobj1 = new Tobject();
        tobj1.setBi(bi2); //没问题
        assertEquals("9423372036854775807", tobj1.getBi().toString());;

        String s2 = JSON.toJSONString(tobj1);
        Tobject tobj2 = JSON.parseObject(s2, Tobject.class);  //有问题
        assertEquals("9423372036854775807", tobj2.getBi().toString());
    }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Issue869_1.java
16 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

               * Created by wenshao on 2016/11/13.
 */
public class Issue869_1 extends TestCase {
    public void test_for_issue() throws Exception {
        List<DoublePoint> doublePointList = new ArrayList<DoublePoint>();
        {
            DoublePoint doublePoint = new DoublePoint();
            doublePoint.startPoint = new Point(22, 35);
            doublePoint.endPoint = doublePoint.startPoint;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

                      }

        String json = JSON.toJSONString(doublePointList);
        assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"$ref\":\"$[1].endPoint\"}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";

            

Reported by PMD.

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

Line: 33

                      assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"$ref\":\"$[1].endPoint\"}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));

            

Reported by PMD.

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

Line: 33

                      assertEquals("[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"x\":16,\"y\":18},\"startPoint\":{\"$ref\":\"$[1].endPoint\"}}]", json);
    }

    public void test_for_issue_parse() throws Exception {

        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 37

              
        String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 38

                      String text = "[{\"endPoint\":{\"x\":22,\"y\":35},\"startPoint\":{\"$ref\":\"$[0].endPoint\"}},{\"endPoint\":{\"$ref\":\"$[1].startPoint\"},\"startPoint\":{\"x\":16,\"y\":18}}]";
        List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static class DoublePoint{

            

Reported by PMD.

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

Line: 39

                      List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 39

                      List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

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

Line: 39

                      List<Issue869.DoublePoint> doublePointList = JSON.parseObject(text, new TypeReference<List<Issue869.DoublePoint>>(){});
        assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static class DoublePoint{
        public Point startPoint;

            

Reported by PMD.

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

Line: 40

                      assertNotNull(doublePointList.get(0));
        assertNotNull(doublePointList.get(1));
        assertSame(doublePointList.get(0).startPoint, doublePointList.get(0).endPoint);
        assertSame(doublePointList.get(1).startPoint, doublePointList.get(1).endPoint);
    }

    public static class DoublePoint{
        public Point startPoint;
        public Point endPoint;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/mixins/MixinSerForMethodsTest.java
16 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 13

              
    @SuppressWarnings( "unused" )
    static class BaseClass {
        private String a;
        private String b;

        protected BaseClass() {
        }


            

Reported by PMD.

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

Line: 14

                  @SuppressWarnings( "unused" )
    static class BaseClass {
        private String a;
        private String b;

        protected BaseClass() {
        }

        public BaseClass( String a,String b ) {

            

Reported by PMD.

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

Line: 31

                  }

    static class BaseClass2 {
        private String a;
        private String b;

        protected BaseClass2() {
        }


            

Reported by PMD.

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

Line: 32

              
    static class BaseClass2 {
        private String a;
        private String b;

        protected BaseClass2() {
        }

        public BaseClass2( String a,String b ) {

            

Reported by PMD.

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

Line: 62

                      abstract String takeA();
    }

    public void test() throws Exception{
        BaseClass bean = new BaseClass( "a1", "b2" );

        String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.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: 62

                      abstract String takeA();
    }

    public void test() throws Exception{
        BaseClass bean = new BaseClass( "a1", "b2" );

        String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.size() );

            

Reported by PMD.

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

Line: 67

              
        String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.size() );
        assertEquals( "b2", result.get( "b" ) );

        BaseClass2 bean2 = new BaseClass2( "a1", "b2" );
        JSON.addMixInAnnotations( BaseClass2.class, MixIn.class );
        jsonString = JSON.toJSONString( bean2 );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 67

              
        String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.size() );
        assertEquals( "b2", result.get( "b" ) );

        BaseClass2 bean2 = new BaseClass2( "a1", "b2" );
        JSON.addMixInAnnotations( BaseClass2.class, MixIn.class );
        jsonString = JSON.toJSONString( bean2 );

            

Reported by PMD.

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

Line: 68

                      String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.size() );
        assertEquals( "b2", result.get( "b" ) );

        BaseClass2 bean2 = new BaseClass2( "a1", "b2" );
        JSON.addMixInAnnotations( BaseClass2.class, MixIn.class );
        jsonString = JSON.toJSONString( bean2 );
        result = JSON.parseObject( jsonString );

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 68

                      String jsonString = JSON.toJSONString( bean );
        JSONObject result = JSON.parseObject( jsonString );
        assertEquals( 1, result.size() );
        assertEquals( "b2", result.get( "b" ) );

        BaseClass2 bean2 = new BaseClass2( "a1", "b2" );
        JSON.addMixInAnnotations( BaseClass2.class, MixIn.class );
        jsonString = JSON.toJSONString( bean2 );
        result = JSON.parseObject( jsonString );

            

Reported by PMD.

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

    public void test_null() throws Exception {
        String text = "{\"calendar\":null}";
        
        VO vo = JSON.parseObject(text, VO.class);
        Assert.assertNull(vo.getCalendar());
    }

            

Reported by PMD.

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

Line: 18

                      String text = "{\"calendar\":null}";
        
        VO vo = JSON.parseObject(text, VO.class);
        Assert.assertNull(vo.getCalendar());
    }
    
    public void test_codec() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();

            

Reported by PMD.

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

Line: 21

                      Assert.assertNull(vo.getCalendar());
    }
    
    public void test_codec() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();
        vo.setCalendar(calendar);
        String text = JSON.toJSONString(vo);
        

            

Reported by PMD.

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

Line: 28

                      String text = JSON.toJSONString(vo);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();

            

Reported by PMD.

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

Line: 28

                      String text = JSON.toJSONString(vo);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();

            

Reported by PMD.

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

Line: 28

                      String text = JSON.toJSONString(vo);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();

            

Reported by PMD.

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

Line: 31

                      Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        VO vo = new VO();
        vo.setCalendar(calendar);
        String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);
        

            

Reported by PMD.

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

Line: 38

                      String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591_2() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        calendar.set(Calendar.SECOND, 0);

            

Reported by PMD.

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

Line: 38

                      String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591_2() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        calendar.set(Calendar.SECOND, 0);

            

Reported by PMD.

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

Line: 38

                      String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);
        
        VO vo2 = JSON.parseObject(text, VO.class);
        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());
    }
    
    public void test_codec_iso88591_2() throws Exception {
        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
        calendar.set(Calendar.SECOND, 0);

            

Reported by PMD.

src/test/java/com/alibaba/fastjson/deserializer/TestISO8601Date.java
16 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 23

                  }

    @Test
    public void testBug1884() {
        Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT+7" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

            

Reported by PMD.

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

Line: 25

                  @Test
    public void testBug1884() {
        Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT+7" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的

            

Reported by PMD.

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

Line: 26

                  public void testBug1884() {
        Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT+7" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的

            

Reported by PMD.

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

Line: 27

                      Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT+7" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的
        Date date1 = JSON.parseObject( s1, JSONObject.class ).getDate( "date" );

            

Reported by PMD.

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

Line: 28

                      cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT+7" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的
        Date date1 = JSON.parseObject( s1, JSONObject.class ).getDate( "date" );
        Date date2 = JSON.parseObject( s2, JSONObject.class ).getDate( "date" );

            

Reported by PMD.

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

Line: 32

              
        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的
        Date date1 = JSON.parseObject( s1, JSONObject.class ).getDate( "date" );
        Date date2 = JSON.parseObject( s2, JSONObject.class ).getDate( "date" );
        assertEquals(date1, date2);
        assertEquals(date, date1);
        assertEquals(date, date2);
    }

            

Reported by PMD.

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

Line: 32

              
        String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的
        Date date1 = JSON.parseObject( s1, JSONObject.class ).getDate( "date" );
        Date date2 = JSON.parseObject( s2, JSONObject.class ).getDate( "date" );
        assertEquals(date1, date2);
        assertEquals(date, date1);
        assertEquals(date, date2);
    }

            

Reported by PMD.

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

Line: 33

                      String s1 = "{date: \"2018-05-31T19:13:42+07:00\"}"; // 错误的
        String s2 = "{date: \"2018-05-31T19:13:42.000+07:00\"}"; // 正确的
        Date date1 = JSON.parseObject( s1, JSONObject.class ).getDate( "date" );
        Date date2 = JSON.parseObject( s2, JSONObject.class ).getDate( "date" );
        assertEquals(date1, date2);
        assertEquals(date, date1);
        assertEquals(date, date2);
    }


            

Reported by PMD.

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

Line: 40

                  }

    @Test
    public void testBug376() {
        Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

            

Reported by PMD.

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

Line: 42

                  @Test
    public void testBug376() {
        Calendar cale = Calendar.getInstance();
        cale.clear();
        cale.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
        cale.set( 2018, Calendar.MAY, 31, 19, 13, 42 );
        Date date = cale.getTime();

        String s1 = "{date: \"2018-05-31T19:13:42Z\"}";

            

Reported by PMD.

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

    public void test_long_error_0() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"value\":1.A}"));
            reader.readObject(Model.class);
        } catch (JSONException ex) {

            

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.assertNotNull(error);
    }

    public void test_long_error_1() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"value\":9223372036854775808}"));
            reader.readObject(Model.class);
        } catch (JSONException ex) {

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_long_error_1_x() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"value\":922337203685477580892233720368547758088}"));
            reader.readObject(Model.class);
        } catch (JSONException ex) {

            

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

                      Assert.assertNotNull(error);
    }

    public void test_long_error_2() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"value\":AA}"));
            reader.readObject(Model.class);
        } catch (JSONException ex) {

            

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

                      Assert.assertNotNull(error);
    }

    public void test_long_normal() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"value\":1001,\"value2\":-2001}"));
        Model model = reader.readObject(Model.class);
        Assert.assertEquals(1001L, model.value);
        Assert.assertEquals(-2001L, model.value2);
        reader.close();

            

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

                      reader.close();
    }

    public void test_long_normal_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":3001,\"value2\":-4001}}"));
        Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
        });
        Model model = map.get("model");
        Assert.assertEquals(3001L, model.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: 78

                      reader.close();
    }

    public void test_long_error_map() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"model\":{\"value\":3001,\"value2\":-4001}["));
            reader.readObject(new TypeReference<Map<String, 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: 90

                      Assert.assertNotNull(error);
    }

    public void test_long_error_end() throws Exception {
        Exception error = null;
        try {
            JSONReader reader = new JSONReader(new StringReader("{\"value\":1001,\"value2\":-2001["));
            reader.readObject(Model.class);
        } catch (JSONException ex) {

            

Reported by PMD.

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

Line: 103

              
    private static class Model {

        public long value;
        public long value2;
    }
}

            

Reported by PMD.

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

Line: 104

                  private static class Model {

        public long value;
        public long value2;
    }
}

            

Reported by PMD.