The following issues were found

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

Line: 13

              
public class JSONFieldTest_unwrapped_2 extends TestCase {

    public void test_jsonField() throws Exception {
        String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);

            

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

              
public class JSONFieldTest_unwrapped_2 extends TestCase {

    public void test_jsonField() throws Exception {
        String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
        Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);

        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

              
        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {

            

Reported by PMD.

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

Line: 19

              
        VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {

            

Reported by PMD.

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

Line: 20

                      VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {
        public int id;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

                      VO vo2 = JSON.parseObject(text, VO.class);
        assertNotNull(vo2.properties);
        assertEquals(37, vo2.properties.get("latitude"));
        assertEquals(127, vo2.properties.get("longitude"));

    }

    public static class VO {
        public int id;

            

Reported by PMD.

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

Line: 27

                  public static class VO {
        public int id;

        private Map<String, Object> properties = new LinkedHashMap<String, Object>();

        @JSONField(unwrapped = true)
        public void setProperty(String key, Object value) {
            properties.put(key, value);
        }

            

Reported by PMD.

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

Line: 27

                  public static class VO {
        public int id;

        private Map<String, Object> properties = new LinkedHashMap<String, Object>();

        @JSONField(unwrapped = true)
        public void setProperty(String key, Object value) {
            properties.put(key, value);
        }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_3400/Issue_20201016_01.java
9 issues
System.out.println is used
Design

Line: 21

                      String s = JSON.toJSONString(config, SerializerFeature.WriteMapNullValue,
                SerializerFeature.QuoteFieldNames, SerializerFeature.WriteNullListAsEmpty);

        System.out.println(s);
    }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

            

Reported by PMD.

System.out.println is used
Design

Line: 28

                  public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }

    public static class Config {
        private UserConfig creator;
        private UserConfig owner;

            

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

              import junit.framework.TestCase;

public class Issue_20201016_01 extends TestCase {
    public void testToString() {
        UserConfig user = new UserConfig();
        user.setAccount("account");
        user.setName("name");

        Config config = new Config();

            

Reported by PMD.

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

Line: 9

              import junit.framework.TestCase;

public class Issue_20201016_01 extends TestCase {
    public void testToString() {
        UserConfig user = new UserConfig();
        user.setAccount("account");
        user.setName("name");

        Config config = new Config();

            

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

                  }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }


            

Reported by PMD.

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

Line: 25

                  }


    public void testFastJson() {
        String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";

        System.out.println( JSON.parseObject(s, Config.class));
    }


            

Reported by PMD.

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

Line: 31

                      System.out.println( JSON.parseObject(s, Config.class));
    }

    public static class Config {
        private UserConfig creator;
        private UserConfig owner;
        private UserConfig agent;

        public UserConfig getCreator() {

            

Reported by PMD.

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

Line: 56

                      }
    }

    public static class UserConfig {
        private String workid;
        private String name;
        private String account;

        public String getWorkid() {

            

Reported by PMD.

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

Line: 4

              package com.alibaba.json.bvt.issue_3400;

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

public class Issue_20201016_01 extends TestCase {
    public void testToString() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue1653.java
9 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 java.util.Map;

public class Issue1653 extends TestCase {
    public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
    public Map<Object, Object> createMap(Type type) {
        return new CaseInsensitiveMap();
    }

            

Reported by PMD.

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

Line: 24

              config.putDeserializer(Map.class, deserializer);

CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 25

              
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
    }
}

            

Reported by PMD.

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

Line: 25

              
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
    }
}

            

Reported by PMD.

Avoid unused imports such as 'org.apache.commons.collections4.map'
Design

Line: 8

              import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.MapDeserializer;
import junit.framework.TestCase;
import org.apache.commons.collections4.map.*;

import java.lang.reflect.Type;
import java.util.Map;

public class Issue1653 extends TestCase {

            

Reported by PMD.

Found 'DU'-anomaly for variable 'config' (lines '15'-'26').
Error

Line: 15

              
public class Issue1653 extends TestCase {
    public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
    public Map<Object, Object> createMap(Type type) {
        return new CaseInsensitiveMap();
    }
};

            

Reported by PMD.

Found 'DU'-anomaly for variable 'config' (lines '15'-'26').
Error

Line: 15

              
public class Issue1653 extends TestCase {
    public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
    public Map<Object, Object> createMap(Type type) {
        return new CaseInsensitiveMap();
    }
};

            

Reported by PMD.

Found 'DU'-anomaly for variable 'deserializer' (lines '16'-'26').
Error

Line: 16

              public class Issue1653 extends TestCase {
    public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
    public Map<Object, Object> createMap(Type type) {
        return new CaseInsensitiveMap();
    }
};
config.putDeserializer(Map.class, deserializer);

            

Reported by PMD.

Found 'DU'-anomaly for variable 'deserializer' (lines '16'-'26').
Error

Line: 16

              public class Issue1653 extends TestCase {
    public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
    public Map<Object, Object> createMap(Type type) {
        return new CaseInsensitiveMap();
    }
};
config.putDeserializer(Map.class, deserializer);

            

Reported by PMD.

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

	public void test_typeRef() throws Exception {
		TypeReference<Map<String, Entity>> typeRef = new TypeReference<Map<String, Entity>>() {
		};

		Map<String, Entity> map = JSON.parseObject(
				"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);

            

Reported by PMD.

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

Line: 22

              		Map<String, Entity> map = JSON.parseObject(
				"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);

		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

            

Reported by PMD.

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

Line: 24

              
		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {

            

Reported by PMD.

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

Line: 25

              		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

            

Reported by PMD.

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

Line: 25

              		Entity entity = map.get("value");
		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 26

              		Assert.assertNotNull(entity);
		Assert.assertEquals("abc", entity.getId());
		Assert.assertEquals(1, entity.getList().size());
		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;


            

Reported by PMD.

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

Line: 29

              		Assert.assertEquals(123, entity.getList().get(0).getId());
	}

	public static class Entity {
		private String id;

		private List<A> list = new ArrayList<A>();

		public String getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ByteFieldTest.java
9 issues
System.out.println is used
Design

Line: 17

                      v.setValue((byte) 10);

        String text = JSON.toJSONString(v);
        System.out.println(text);

        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.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: 12

              
public class ByteFieldTest extends TestCase {

    public void test_codec() throws Exception {
        V0 v = new V0();
        v.setValue((byte) 10);

        String text = JSON.toJSONString(v);
        System.out.println(text);

            

Reported by PMD.

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

Line: 21

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null() throws Exception {
        V0 v = new V0();


            

Reported by PMD.

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

Line: 24

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 35

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }
    
    public void test_codec_null_asm() throws Exception {
        V0 v = new V0();


            

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.assertEquals(v1.getValue(), v.getValue());
    }
    
    public void test_codec_null_asm() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(true);


            

Reported by PMD.

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

Line: 49

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();


            

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

                      Assert.assertEquals(v1.getValue(), v.getValue());
    }

    public void test_codec_null_1() throws Exception {
        V0 v = new V0();

        SerializeConfig mapping = new SerializeConfig();
        mapping.setAsmEnable(false);


            

Reported by PMD.

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

Line: 63

              
        V0 v1 = JSON.parseObject(text, V0.class);

        Assert.assertEquals(Byte.valueOf((byte) 0), v1.getValue());
    }

    public static class V0 {

        private Byte value;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/IntFieldTest2.java
9 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: 17

              
public class IntFieldTest2 extends TestCase {

    public void test_model() throws Exception {
        Model model = new Model();
        model.id = -1001;
        model.id2 = -1002;

        String text = JSON.toJSONString(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: 26

                      Assert.assertEquals("{\"id\":-1001,\"id2\":-1002}", text);
    }

    public void test_model_max() throws Exception {
        Model model = new Model();
        model.id = Integer.MIN_VALUE;
        model.id2 = Integer.MAX_VALUE;

        String text = JSON.toJSONString(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: 42

                      }
    }

    public void test_model_map() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Map<String, Model> map = 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: 54

                      reader.close();
    }

    public void test_model_map_error() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {

            

Reported by PMD.

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

Line: 68

                      Assert.assertNotNull(error);
    }
    
    public void test_model_map_error_2() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {

            

Reported by PMD.

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

Line: 84

              
    public static class Model {

        public int id;
        public int id2;
    }
}

            

Reported by PMD.

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

Line: 85

                  public static class Model {

        public int id;
        public int id2;
    }
}

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '57'-'63').
Error

Line: 57

                  public void test_model_map_error() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {
            reader.readObject(new TypeReference<Map<String, Model>>() {
            });
        } catch (JSONException ex) {

            

Reported by PMD.

Found 'DD'-anomaly for variable 'error' (lines '71'-'77').
Error

Line: 71

                  public void test_model_map_error_2() throws Exception {
        String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";

        Exception error = null;
        JSONReader reader = new JSONReader(new StringReader(text));
        try {
            reader.readObject(new TypeReference<Map<String, Model>>() {
            });
        } catch (JSONException ex) {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_1600/Issue1603_getter.java
9 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 java.util.Collections;

public class Issue1603_getter extends TestCase {
    public void test_emptySet() throws Exception {
        Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
        assertEquals(0, m.values.size());
    }

    public void test_emptyList() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 13

              public class Issue1603_getter extends TestCase {
    public void test_emptySet() throws Exception {
        Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
        assertEquals(0, m.values.size());
    }

    public void test_emptyList() throws Exception {
        Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
        assertEquals(0, m.values.size());

            

Reported by PMD.

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

Line: 13

              public class Issue1603_getter extends TestCase {
    public void test_emptySet() throws Exception {
        Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
        assertEquals(0, m.values.size());
    }

    public void test_emptyList() throws Exception {
        Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
        assertEquals(0, m.values.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: 16

                      assertEquals(0, m.values.size());
    }

    public void test_emptyList() throws Exception {
        Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
        assertEquals(0, m.values.size());
    }

    public void test_unmodifier() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

              
    public void test_emptyList() throws Exception {
        Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
        assertEquals(0, m.values.size());
    }

    public void test_unmodifier() throws Exception {
        Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
        assertEquals(0, m.values.size());

            

Reported by PMD.

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

Line: 18

              
    public void test_emptyList() throws Exception {
        Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
        assertEquals(0, m.values.size());
    }

    public void test_unmodifier() throws Exception {
        Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
        assertEquals(0, m.values.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: 21

                      assertEquals(0, m.values.size());
    }

    public void test_unmodifier() throws Exception {
        Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
        assertEquals(0, m.values.size());
    }

    public static class Model_1 {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
    public void test_unmodifier() throws Exception {
        Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
        assertEquals(0, m.values.size());
    }

    public static class Model_1 {
        private final Collection<String> values = Collections.emptySet();


            

Reported by PMD.

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

Line: 23

              
    public void test_unmodifier() throws Exception {
        Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
        assertEquals(0, m.values.size());
    }

    public static class Model_1 {
        private final Collection<String> values = Collections.emptySet();


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArray2Test.java
9 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 FieldFloatArray2Test extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);

            

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 FieldFloatArray2Test extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldFloatArray2Test extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);
        assertEquals(2.1f, model.value[0][1]);
        assertEquals(-0.3f, model.value[0][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,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);
        assertEquals(2.1f, model.value[0][1]);
        assertEquals(-0.3f, model.value[0][2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

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


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

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

    public static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

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

    public static class Model {
        public float[][] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

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

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

            

Reported by PMD.

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

Line: 21

                  }

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

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArray2Test_private.java
9 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 FieldFloatArray2Test_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);

            

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 FieldFloatArray2Test_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

              public class FieldFloatArray2Test_private extends TestCase {
    public void test_intArray() throws Exception {
        Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);
        assertEquals(2.1f, model.value[0][1]);
        assertEquals(-0.3f, model.value[0][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,2.1,-0.3]]}", Model.class);
        assertNotNull(model.value);
        assertEquals(1, model.value.length);
        assertEquals(3, model.value[0].length);
        assertEquals(1f, model.value[0][0]);
        assertEquals(2.1f, model.value[0][1]);
        assertEquals(-0.3f, model.value[0][2]);
    }

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 14

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


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

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

    private static class Model {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

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

    private static class Model {
        public float[][] value;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

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

    private static class Model {
        public float[][] value;
    }

            

Reported by PMD.

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

Line: 21

                  }

    private static class Model {
        public float[][] value;
    }
}

            

Reported by PMD.

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

    public void test_true() throws Exception {
        String text = "{\"f001\":1001,\"value\":true}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertTrue(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: 21

                      Assert.assertTrue(model.value);
    }

    public void test_false() throws Exception {
        String text = "{\"f001\":1001,\"value\":false}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertFalse(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: 28

                      Assert.assertFalse(model.value);
    }

    public void test_true_reader() throws Exception {
        String text = "{\"f001\":1001,\"value\":true}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertTrue(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: 37

                      reader.close();
    }

    public void test_false_reader() throws Exception {
        String text = "{\"f001\":1001,\"value\":false}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertFalse(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: 46

                      reader.close();
    }
    
    public void test_1() throws Exception {
        String text = "{\"value\":1}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertTrue(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: 53

                      Assert.assertTrue(model.value);
    }
    
    public void test_0() throws Exception {
        String text = "{\"value\":0}";

        Model model = JSON.parseObject(text, Model.class);
        Assert.assertFalse(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: 60

                      Assert.assertFalse(model.value);
    }
    
    public void test_1_reader() throws Exception {
        String text = "{\"value\":1}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertTrue(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: 69

                      reader.close();
    }
    
    public void test_0_reader() throws Exception {
        String text = "{\"value\":0}";

        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertFalse(model.value);

            

Reported by PMD.

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

Line: 80

              
    public static class Model {

        public boolean value;
    }
}

            

Reported by PMD.