The following issues were found

src/test/java/com/alibaba/json/bvt/path/JSONPath_set_test6.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 13

              import java.util.Map;

public class JSONPath_set_test6 extends TestCase {
    public void test_jsonpath_1() throws Exception {
        JSONObject aa= new JSONObject();
        aa.put("app-a", "haj ");
        JSONPath.set(aa, "$.app\\-a\\.x", "123");
        assertEquals("haj ", aa.getString("app-a"));
        assertEquals("123", aa.getString("app-a.x"));

            

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

              import java.util.Map;

public class JSONPath_set_test6 extends TestCase {
    public void test_jsonpath_1() throws Exception {
        JSONObject aa= new JSONObject();
        aa.put("app-a", "haj ");
        JSONPath.set(aa, "$.app\\-a\\.x", "123");
        assertEquals("haj ", aa.getString("app-a"));
        assertEquals("123", aa.getString("app-a.x"));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      JSONObject aa= new JSONObject();
        aa.put("app-a", "haj ");
        JSONPath.set(aa, "$.app\\-a\\.x", "123");
        assertEquals("haj ", aa.getString("app-a"));
        assertEquals("123", aa.getString("app-a.x"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      aa.put("app-a", "haj ");
        JSONPath.set(aa, "$.app\\-a\\.x", "123");
        assertEquals("haj ", aa.getString("app-a"));
        assertEquals("123", aa.getString("app-a.x"));
    }
}

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.JSON'
Design

Line: 3

              package com.alibaba.json.bvt.path;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import junit.framework.TestCase;
import org.junit.Assert;

import java.util.HashMap;

            

Reported by PMD.

Avoid unused imports such as 'org.junit.Assert'
Design

Line: 7

              import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPath;
import junit.framework.TestCase;
import org.junit.Assert;

import java.util.HashMap;
import java.util.Map;

public class JSONPath_set_test6 extends TestCase {

            

Reported by PMD.

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

Line: 9

              import junit.framework.TestCase;
import org.junit.Assert;

import java.util.HashMap;
import java.util.Map;

public class JSONPath_set_test6 extends TestCase {
    public void test_jsonpath_1() throws Exception {
        JSONObject aa= new JSONObject();

            

Reported by PMD.

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

Line: 10

              import org.junit.Assert;

import java.util.HashMap;
import java.util.Map;

public class JSONPath_set_test6 extends TestCase {
    public void test_jsonpath_1() throws Exception {
        JSONObject aa= new JSONObject();
        aa.put("app-a", "haj ");

            

Reported by PMD.

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

                  private static SerializeConfig config = new SerializeConfig(true);
    private static ParserConfig parserConfig = new ParserConfig(true);

    public void test_0() throws Exception {
        Model model = new Model();
        ((AbstractModel)model).parentId = 234;
        model.id = 123;
        assertEquals("{\"id\":123,\"parentId\":234}", JSON.toJSONString(model, config));


            

Reported by PMD.

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

Line: 15

                  private static SerializeConfig config = new SerializeConfig(true);
    private static ParserConfig parserConfig = new ParserConfig(true);

    public void test_0() throws Exception {
        Model model = new Model();
        ((AbstractModel)model).parentId = 234;
        model.id = 123;
        assertEquals("{\"id\":123,\"parentId\":234}", JSON.toJSONString(model, config));


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      Model model = new Model();
        ((AbstractModel)model).parentId = 234;
        model.id = 123;
        assertEquals("{\"id\":123,\"parentId\":234}", JSON.toJSONString(model, config));

        Model model2 = JSON.parseObject("{\"id\":123,\"parentId\":234}", Model.class, parserConfig);
        assertEquals(((AbstractModel) model).parentId, ((AbstractModel) model).parentId);
        assertEquals(model.id, model2.id);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 22

                      assertEquals("{\"id\":123,\"parentId\":234}", JSON.toJSONString(model, config));

        Model model2 = JSON.parseObject("{\"id\":123,\"parentId\":234}", Model.class, parserConfig);
        assertEquals(((AbstractModel) model).parentId, ((AbstractModel) model).parentId);
        assertEquals(model.id, model2.id);
    }

    public static class AbstractModel {
        private int parentId;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
        Model model2 = JSON.parseObject("{\"id\":123,\"parentId\":234}", Model.class, parserConfig);
        assertEquals(((AbstractModel) model).parentId, ((AbstractModel) model).parentId);
        assertEquals(model.id, model2.id);
    }

    public static class AbstractModel {
        private int parentId;
    }

            

Reported by PMD.

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

Line: 27

                  }

    public static class AbstractModel {
        private int parentId;
    }

    public static class Model extends AbstractModel {
        private int id;
    }

            

Reported by PMD.

Perhaps 'parentId' could be replaced by a local variable.
Design

Line: 27

                  }

    public static class AbstractModel {
        private int parentId;
    }

    public static class Model extends AbstractModel {
        private int id;
    }

            

Reported by PMD.

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

Line: 31

                  }

    public static class Model extends AbstractModel {
        private int id;
    }
}

            

Reported by PMD.

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

    public void test_true() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"items\":[{}],\"value\":{}}"));
        VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());

            

Reported by PMD.

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

Line: 17

                  public void test_true() throws Exception {
        DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"items\":[{}],\"value\":{}}"));
        VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

            

Reported by PMD.

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

Line: 18

                      DefaultJSONParser parser = new DefaultJSONParser(new JSONReaderScanner("{\"items\":[{}],\"value\":{}}"));
        VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }


            

Reported by PMD.

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

Line: 19

                      VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

    public static class VO {

            

Reported by PMD.

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

Line: 19

                      VO vo = parser.parseObject(VO.class);
        Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

    public static class VO {

            

Reported by PMD.

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

Line: 20

                      Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

    public static class VO {


            

Reported by PMD.

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

Line: 20

                      Assert.assertNotNull(vo.getValue());
        Assert.assertNotNull(vo.getItems());
        Assert.assertEquals(1, vo.getItems().size());
        Assert.assertNotNull(vo.getItems().get(0));
        parser.close();
    }

    public static class VO {


            

Reported by PMD.

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

Line: 24

                      parser.close();
    }

    public static class VO {

        private List<Item> items;
        private Entity     value;

        public Entity getValue() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest.java
8 issues
System.out.println is used
Design

Line: 17

              
    @SuppressWarnings("rawtypes")
    public void test_0() throws Exception {
        System.out.println(System.getProperties());
        String text;

        {
            Map<String, Bean> map = new HashMap<String, Bean>();
            map.put("a", new Bean(123, "马加爵"));

            

Reported by PMD.

System.out.println is used
Design

Line: 29

                          text = JSON.toJSONString(map);
        }

        System.out.println(text);

        {
            Map<String, Bean> map = JSON.parseObject(text, new TypeReference<Map<String, Bean>>() {}); // 注意这里
            Assert.assertEquals(3, map.size());
            Assert.assertEquals(123, ((Bean) map.get("a")).getId());

            

Reported by PMD.

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

Line: 15

              
public class TypeReferenceTest extends TestCase {

    @SuppressWarnings("rawtypes")
    public void test_0() throws Exception {
        System.out.println(System.getProperties());
        String text;

        {

            

Reported by PMD.

The String literal '马加爵' appears 4 times in this file; the first occurrence is on line 22
Error

Line: 22

              
        {
            Map<String, Bean> map = new HashMap<String, Bean>();
            map.put("a", new Bean(123, "马加爵"));
            map.put("b", new Bean(234, "药家鑫"));
            map.put("c", new Bean(456, "刘大伟"));

            text = JSON.toJSONString(map);
        }

            

Reported by PMD.

The String literal '药家鑫' appears 4 times in this file; the first occurrence is on line 23
Error

Line: 23

                      {
            Map<String, Bean> map = new HashMap<String, Bean>();
            map.put("a", new Bean(123, "马加爵"));
            map.put("b", new Bean(234, "药家鑫"));
            map.put("c", new Bean(456, "刘大伟"));

            text = JSON.toJSONString(map);
        }


            

Reported by PMD.

The String literal '刘大伟' appears 4 times in this file; the first occurrence is on line 24
Error

Line: 24

                          Map<String, Bean> map = new HashMap<String, Bean>();
            map.put("a", new Bean(123, "马加爵"));
            map.put("b", new Bean(234, "药家鑫"));
            map.put("c", new Bean(456, "刘大伟"));

            text = JSON.toJSONString(map);
        }

        System.out.println(text);

            

Reported by PMD.

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

Line: 50

                          Assert.assertEquals(234, ((JSONObject) map.get("b")).get("id"));
            Assert.assertEquals(456, ((JSONObject) map.get("c")).get("id"));
            
            Assert.assertEquals("马加爵", ((JSONObject) map.get("a")).get("name"));
            Assert.assertEquals("药家鑫", ((JSONObject) map.get("b")).get("name"));
            Assert.assertEquals("刘大伟", ((JSONObject) map.get("c")).get("name"));
        }
        
        {

            

Reported by PMD.

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

Line: 68

                      }
    }

    public static class Bean {

        private int    id;
        private String name;

        public Bean(){

            

Reported by PMD.

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

    public void test_null() throws Exception {
        Entity value = JSON.parseObject("{value:null}", Entity.class);
        Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {

            

Reported by PMD.

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

Line: 15

              
    public void test_null() throws Exception {
        Entity value = JSON.parseObject("{value:null}", Entity.class);
        Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().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: 18

                      Assert.assertNull(value.getValue());
    }

    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

            

Reported by PMD.

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

Line: 20

              
    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

        private TreeSet value;

            

Reported by PMD.

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

Line: 20

              
    public void test_empty() throws Exception {
        Entity value = JSON.parseObject("{value:[]}", Entity.class);
        Assert.assertEquals(0, value.getValue().size());
    }

    private static class Entity {

        private TreeSet value;

            

Reported by PMD.

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

Line: 25

              
    private static class Entity {

        private TreeSet value;

        public TreeSet getValue() {
            return value;
        }


            

Reported by PMD.

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

Line: 27

              
        private TreeSet value;

        public TreeSet getValue() {
            return value;
        }

        public void setValue(TreeSet value) {
            this.value = value;

            

Reported by PMD.

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

Line: 31

                          return value;
        }

        public void setValue(TreeSet value) {
            this.value = value;
        }
    }
}

            

Reported by PMD.

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

    @SuppressWarnings({"unchecked" })
    public void test_0() throws Exception {
        
        Root root = new Root();
        root.company = new Company();
        root.company.departs.add(new Department(1001));

            

Reported by PMD.

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

Line: 25

                      

        List<Object> ids = (List<Object>) JSONPath.eval(root, "$..id");
        Assert.assertEquals(3, ids.size());
        Assert.assertEquals(1001, ids.get(0));
        Assert.assertEquals(1002, ids.get(1));
        Assert.assertEquals(1003, ids.get(2));
    }


            

Reported by PMD.

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

Line: 26

              
        List<Object> ids = (List<Object>) JSONPath.eval(root, "$..id");
        Assert.assertEquals(3, ids.size());
        Assert.assertEquals(1001, ids.get(0));
        Assert.assertEquals(1002, ids.get(1));
        Assert.assertEquals(1003, ids.get(2));
    }

    public static class Root {

            

Reported by PMD.

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

Line: 27

                      List<Object> ids = (List<Object>) JSONPath.eval(root, "$..id");
        Assert.assertEquals(3, ids.size());
        Assert.assertEquals(1001, ids.get(0));
        Assert.assertEquals(1002, ids.get(1));
        Assert.assertEquals(1003, ids.get(2));
    }

    public static class Root {
        public Company company;

            

Reported by PMD.

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

Line: 28

                      Assert.assertEquals(3, ids.size());
        Assert.assertEquals(1001, ids.get(0));
        Assert.assertEquals(1002, ids.get(1));
        Assert.assertEquals(1003, ids.get(2));
    }

    public static class Root {
        public Company company;
    }

            

Reported by PMD.

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

Line: 32

                  }

    public static class Root {
        public Company company;
    }
    
    public static class Company {
        public List<Department> departs = new ArrayList<Department>();
    }

            

Reported by PMD.

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

Line: 36

                  }
    
    public static class Company {
        public List<Department> departs = new ArrayList<Department>();
    }
    
    public static class Department {
        public int id;
        

            

Reported by PMD.

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

Line: 40

                  }
    
    public static class Department {
        public int id;
        
        public Department() {
            
        }
        

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/date/DateTest_ISO8601_ThreeLetterISO8601TimeZone.java
8 issues
A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 13

              
public class DateTest_ISO8601_ThreeLetterISO8601TimeZone extends TestCase {

    public void f_test_date() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.2+08:00\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        

            

Reported by PMD.

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

Line: 16

                  public void f_test_date() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.2+08:00\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    

            

Reported by PMD.

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

Line: 19

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+09:00\"}";
        

            

Reported by PMD.

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

Line: 19

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+09:00\"}";
        

            

Reported by PMD.

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

Line: 22

                      Assert.assertEquals(8, date.getTimeZone().getRawOffset()/(3600*1000));
    }
    
    public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+09:00\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        

            

Reported by PMD.

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

Line: 25

                  public void test_date_9() throws Exception {
        String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.235+09:00\"}";
        
        Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }


            

Reported by PMD.

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

Line: 28

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }

    public static class VO {

        private Calendar gmtCreate;

            

Reported by PMD.

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

Line: 28

                      Calendar date = JSON.parseObject(text, VO.class).getGmtCreate();
        Assert.assertNotNull(date);
        
        Assert.assertEquals(9, date.getTimeZone().getRawOffset()/(3600*1000));
    }

    public static class VO {

        private Calendar gmtCreate;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest12.java
8 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 14

               */
public class TypeReferenceTest12 extends TestCase {

    public void test_same() throws Exception {
        ParameterizedType type1 = getType(Integer.class);
        ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());

            

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 TypeReferenceTest12 extends TestCase {

    public void test_same() throws Exception {
        ParameterizedType type1 = getType(Integer.class);
        ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());

            

Reported by PMD.

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

Line: 18

                      ParameterizedType type1 = getType(Integer.class);
        ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();

            

Reported by PMD.

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

Line: 18

                      ParameterizedType type1 = getType(Integer.class);
        ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      ParameterizedType type1 = getType(Integer.class);
        ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();

            

Reported by PMD.

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

Line: 19

                      ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

                      ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();
    }

            

Reported by PMD.

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

Line: 19

                      ParameterizedType type2 = getType();

        assertEquals(type1.getRawType(), type2.getRawType());
        assertSame(type1.getRawType(), type2.getRawType());
    }

    <T> ParameterizedType getType(Type type) {
        return (ParameterizedType)new TypeReference<Model<T>>(type) {}.getType();
    }

            

Reported by PMD.

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

               * Created by wenshao on 11/01/2017.
 */
public class FieldShortArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldShortArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldShortArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public short[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public short[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public short[] value;
    }
}

            

Reported by PMD.

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

               * Created by wenshao on 11/01/2017.
 */
public class FieldLongArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

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

Line: 10

               * Created by wenshao on 11/01/2017.
 */
public class FieldLongArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldLongArrayTest extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

                  public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

                      Model model = JSON.parseObject("{\"value\":[1,null,3]}", Model.class);
        assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                      assertNotNull(model.value);
        assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public long[] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      assertEquals(3, model.value.length);
        assertEquals(1, model.value[0]);
        assertEquals(0, model.value[1]);
        assertEquals(3, model.value[2]);
    }

    public static class Model {
        public long[] value;
    }

            

Reported by PMD.

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

Line: 20

                  }

    public static class Model {
        public long[] value;
    }
}

            

Reported by PMD.