The following issues were found

src/test/java/com/alibaba/json/bvt/proxy/TestProxy.java
6 issues
System.out.println is used
Design

Line: 18

                      
        String text = JSON.toJSONString(vo);
        
        System.out.println(text);
    }
    
    public static interface I {
        
    }

            

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

    public void test_0() throws Exception {
        Object vo = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {I.class}, new VO());
        
        String text = JSON.toJSONString(vo);
        
        System.out.println(text);

            

Reported by PMD.

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

Line: 13

              
public class TestProxy extends TestCase {

    public void test_0() throws Exception {
        Object vo = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {I.class}, new VO());
        
        String text = JSON.toJSONString(vo);
        
        System.out.println(text);

            

Reported by PMD.

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

Line: 14

              public class TestProxy extends TestCase {

    public void test_0() throws Exception {
        Object vo = Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {I.class}, new VO());
        
        String text = JSON.toJSONString(vo);
        
        System.out.println(text);
    }

            

Reported by PMD.

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

Line: 26

                  }
    

    public static class VO implements InvocationHandler {

        private int    id;
        private String name;

        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 31

                      private int    id;
        private String name;

        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            return null;
        }
        
        public int getId() {
            return id;

            

Reported by PMD.

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

    public void test_nullList() {
        SerializerFeature[] features = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty };
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO1(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO2(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO3(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO4(), features));

            

Reported by PMD.

The String literal '{\'names\':[]}' appears 4 times in this file; the first occurrence is on line 15
Error

Line: 15

              
    public void test_nullList() {
        SerializerFeature[] features = { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty };
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO1(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO2(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO3(), features));
        Assert.assertEquals("{\"names\":[]}", JSON.toJSONString(new VO4(), features));
    }


            

Reported by PMD.

Avoid using redundant field initializer for 'names'
Performance

Line: 23

              
    public static class VO1 {

        private List<Object> names = null;

        public List<Object> getNames() {
            return names;
        }


            

Reported by PMD.

Avoid using redundant field initializer for 'names'
Performance

Line: 36

              
    public static class VO2 {

        private List<String> names = null;

        public List<String> getNames() {
            return names;
        }


            

Reported by PMD.

Avoid using redundant field initializer for 'names'
Performance

Line: 49

                  
    public static class VO3 {

        private List<Integer> names = null;

        public List<Integer> getNames() {
            return names;
        }


            

Reported by PMD.

Avoid using redundant field initializer for 'names'
Performance

Line: 62

                  
    public static class VO4 {
        
        private List<Long> names = null;
        
        public List<Long> getNames() {
            return names;
        }
        

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest12.java
6 issues
System.out.println is used
Design

Line: 18

                      entity.getChild().setParent(entity);

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

        ParserConfig config = new ParserConfig();
        config.setAsmEnable(false);
        Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);


            

Reported by PMD.

System.out.println is used
Design

Line: 26

              
        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

        private final int   id;

            

Reported by PMD.

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

Line: 13

              
public class RefTest12 extends TestCase {

    public void test_0() throws Exception {
        Entity entity = new Entity(123, new Child());
        entity.getChild().setParent(entity);

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

            

Reported by PMD.

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

Line: 15

              
    public void test_0() throws Exception {
        Entity entity = new Entity(123, new Child());
        entity.getChild().setParent(entity);

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

        ParserConfig config = new ParserConfig();

            

Reported by PMD.

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

Line: 24

                      config.setAsmEnable(false);
        Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);

        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

            

Reported by PMD.

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

Line: 24

                      config.setAsmEnable(false);
        Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);

        Assert.assertEquals(entity2, entity2.getChild().getParent());

        System.out.println(JSON.toJSONString(entity2));
    }

    public static class Entity {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest16.java
6 issues
System.out.println is used
Design

Line: 28

              
        Family[] familyArray = new Family[] { fA, fB };
        String text = JSON.toJSONString(familyArray);
        System.out.println(text);

        Family[] result = JSON.parseObject(text, Family[].class);

        Assert.assertSame(result[0].getMaster(), result[0].getMembers()[0]);
        Assert.assertSame(result[1].getMaster(), result[1].getMembers()[0]);

            

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

              
public class RefTest16 extends TestCase {

    public void test_0() throws Exception {

        Person pA = new Person("a");
        Person pB = new Person("b");

        Family fA = new Family();

            

Reported by PMD.

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

Line: 37

              
    }

    public static class Family {

        private Person   master;
        private Person[] members;

        public Person getMaster() {

            

Reported by PMD.

Returning 'members' may expose an internal array.
Design

Line: 51

                      }

        public Person[] getMembers() {
            return members;
        }

        public void setMembers(Person[] members) {
            this.members = members;
        }

            

Reported by PMD.

The user-supplied array 'members' is stored directly.
Design

Line: 54

                          return members;
        }

        public void setMembers(Person[] members) {
            this.members = members;
        }

    }


            

Reported by PMD.

Consider using varargs for methods or constructors which take an array the last parameter.
Design

Line: 54

                          return members;
        }

        public void setMembers(Person[] members) {
            this.members = members;
        }

    }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/ref/RefTest22.java
6 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 12

               * Created by wenshao on 16/8/23.
 */
public class RefTest22 extends TestCase {
    public void test_ref() throws Exception {
        String json = "{\"name\":\"123\",\"assetSize\":{},\"items\":[{\"id\":123}],\"refItems\":{\"$ref\":\"$.items[0]\"}}";
        JSONObject root = JSON.parseObject(json);
        assertSame(root.getJSONArray("items").get(0), root.getJSONObject("refItems"));
    }
}

            

Reported by PMD.

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

Line: 15

                  public void test_ref() throws Exception {
        String json = "{\"name\":\"123\",\"assetSize\":{},\"items\":[{\"id\":123}],\"refItems\":{\"$ref\":\"$.items[0]\"}}";
        JSONObject root = JSON.parseObject(json);
        assertSame(root.getJSONArray("items").get(0), root.getJSONObject("refItems"));
    }
}

            

Reported by PMD.

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

Line: 15

                  public void test_ref() throws Exception {
        String json = "{\"name\":\"123\",\"assetSize\":{},\"items\":[{\"id\":123}],\"refItems\":{\"$ref\":\"$.items[0]\"}}";
        JSONObject root = JSON.parseObject(json);
        assertSame(root.getJSONArray("items").get(0), root.getJSONObject("refItems"));
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 15

                  public void test_ref() throws Exception {
        String json = "{\"name\":\"123\",\"assetSize\":{},\"items\":[{\"id\":123}],\"refItems\":{\"$ref\":\"$.items[0]\"}}";
        JSONObject root = JSON.parseObject(json);
        assertSame(root.getJSONArray("items").get(0), root.getJSONObject("refItems"));
    }
}

            

Reported by PMD.

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

Line: 15

                  public void test_ref() throws Exception {
        String json = "{\"name\":\"123\",\"assetSize\":{},\"items\":[{\"id\":123}],\"refItems\":{\"$ref\":\"$.items[0]\"}}";
        JSONObject root = JSON.parseObject(json);
        assertSame(root.getJSONArray("items").get(0), root.getJSONObject("refItems"));
    }
}

            

Reported by PMD.

Avoid unused imports such as 'com.alibaba.fastjson.parser.Feature'
Design

Line: 5

              
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.Feature;
import junit.framework.TestCase;

/**
 * Created by wenshao on 16/8/23.
 */

            

Reported by PMD.

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

    public void test_str() throws Exception {
        Object[] array = new Object[2];
        array[0] = "abc";
        array[1] = array[0];
        Assert.assertEquals("[\"abc\",\"abc\"]", JSON.toJSONString(array));
    }

            

Reported by PMD.

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

Line: 20

                      Assert.assertEquals("[\"abc\",\"abc\"]", JSON.toJSONString(array));
    }

    public void test_decimal() throws Exception {
        Object[] array = new Object[2];
        array[0] = new BigDecimal("123");
        array[1] = array[0];
        Assert.assertEquals("[123,123]", JSON.toJSONString(array));
    }

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals("[123,123]", JSON.toJSONString(array));
    }
    
    public void test_integer() throws Exception {
        Object[] array = new Object[2];
        array[0] = Integer.valueOf(123);
        array[1] = array[0];
        Assert.assertEquals("[123,123]", JSON.toJSONString(array));
    }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'array' (lines '14'-'15').
Error

Line: 14

              public class RefTest4 extends TestCase {

    public void test_str() throws Exception {
        Object[] array = new Object[2];
        array[0] = "abc";
        array[1] = array[0];
        Assert.assertEquals("[\"abc\",\"abc\"]", JSON.toJSONString(array));
    }


            

Reported by PMD.

Found 'DD'-anomaly for variable 'array' (lines '21'-'22').
Error

Line: 21

                  }

    public void test_decimal() throws Exception {
        Object[] array = new Object[2];
        array[0] = new BigDecimal("123");
        array[1] = array[0];
        Assert.assertEquals("[123,123]", JSON.toJSONString(array));
    }
    

            

Reported by PMD.

Found 'DD'-anomaly for variable 'array' (lines '28'-'29').
Error

Line: 28

                  }
    
    public void test_integer() throws Exception {
        Object[] array = new Object[2];
        array[0] = Integer.valueOf(123);
        array[1] = array[0];
        Assert.assertEquals("[123,123]", JSON.toJSONString(array));
    }
}

            

Reported by PMD.

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

    public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.writeFieldValue(',', "name", (Enum) null);
        Assert.assertEquals(",\"name\":null", out.toString());
    }

            

Reported by PMD.

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

Line: 16

                  public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.writeFieldValue(',', "name", (Enum) null);
        Assert.assertEquals(",\"name\":null", out.toString());
    }
    
    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter(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: 20

                      Assert.assertEquals(",\"name\":null", out.toString());
    }
    
    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.writeFieldValue(',', "name", (BigDecimal) null);
        Assert.assertEquals(",\"name\":null", out.toString());
    }

            

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.assertEquals(",\"name\":null", out.toString());
    }
    
    public void test_2() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.writeFieldValue(',', "name", (String) null);
        Assert.assertEquals(",\"name\":null", out.toString());
    }

            

Reported by PMD.

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

Line: 34

                      Assert.assertEquals(",\"name\":null", out.toString());
    }
    
    public void test_3() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.UseSingleQuotes, true);
        out.writeFieldValue(',', "name", (String) null);
        Assert.assertEquals(",'name':null", out.toString());

            

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

                      Assert.assertEquals(",'name':null", out.toString());
    }
    
    public void test_4() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.UseSingleQuotes, true);
        out.writeFieldValue(',', "name", (String) null);
        Assert.assertEquals(",'name':null", out.toString());

            

Reported by PMD.

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

              @SuppressWarnings("deprecation")
public class SerializeWriterTest_4 extends TestCase {

    public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, true);
        out.writeFieldValue(',', "name", "\t");
        Assert.assertEquals(",\"name\":\"\\t\"", out.toString());

            

Reported by PMD.

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

Line: 17

                      SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, true);
        out.writeFieldValue(',', "name", "\t");
        Assert.assertEquals(",\"name\":\"\\t\"", out.toString());
        out.close();
    }
    
    public void test_1() throws Exception {

            

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

                      out.close();
    }
    
    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, true);
        out.writeFieldValue(',', "name", "\t\n");
        Assert.assertEquals(",\"name\":\"\\t\\n\"", out.toString());

            

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

                      out.close();
    }

    public void test_3() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, true);
        out.writeFieldValue(',', "name", "\t\n \b\n\r\f\\ \"");
        Assert.assertEquals(",\"name\":\"\\t\\n \\b\\n\\r\\f\\\\ \\\"\"", out.toString());

            

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

                      out.close();
    }

    public void test_4() throws Exception {
        SerializeWriter out = new SerializeWriter(1);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, false);
        out.writeFieldValue(',', "name", "\t\n \b\n\r\f\\ \"");
        Assert.assertEquals(",\"name\":\"\\t\\n \\b\\n\\r\\f\\\\ \\\"\"", out.toString());

            

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

                      out.close();
    }
    
    public void test_5() throws Exception {
        SerializeWriter out = new SerializeWriter(1000);
        out.config(SerializerFeature.QuoteFieldNames, true);
        out.config(SerializerFeature.WriteTabAsSpecial, true);
        out.writeString("\t\n \b\n\r\f\\ \"");
        Assert.assertEquals("\"\\t\\n \\b\\n\\r\\f\\\\ \\\"\"", out.toString());

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/creator/JSONCreatorTest_float.java
6 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 JSONCreatorTest_float extends TestCase {

    public void test_create() throws Exception {
        Entity entity = new Entity(123.45F, "菜姐");
        String text = JSON.toJSONString(entity);
        
        Entity entity2 = JSON.parseObject(text, Entity.class);
        Assert.assertTrue(entity.getId() == entity2.getId());

            

Reported by PMD.

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

Line: 18

                      String text = JSON.toJSONString(entity);
        
        Entity entity2 = JSON.parseObject(text, Entity.class);
        Assert.assertTrue(entity.getId() == entity2.getId());
        Assert.assertEquals(entity.getName(), entity2.getName());
    }
    
    public void test_create_2() throws Exception {
        Entity entity = new Entity(123.45F, "菜姐");

            

Reported by PMD.

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

Line: 19

                      
        Entity entity2 = JSON.parseObject(text, Entity.class);
        Assert.assertTrue(entity.getId() == entity2.getId());
        Assert.assertEquals(entity.getName(), entity2.getName());
    }
    
    public void test_create_2() throws Exception {
        Entity entity = new Entity(123.45F, "菜姐");
        String text = JSON.toJSONString(entity);

            

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(entity.getName(), entity2.getName());
    }
    
    public void test_create_2() throws Exception {
        Entity entity = new Entity(123.45F, "菜姐");
        String text = JSON.toJSONString(entity);
        
        ParserConfig config = new ParserConfig();
        

            

Reported by PMD.

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

Line: 29

                      ParserConfig config = new ParserConfig();
        
        Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
        Assert.assertTrue(entity.getId() == entity2.getId());
        Assert.assertEquals(entity.getName(), entity2.getName());
    }

    public static class Entity {


            

Reported by PMD.

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

Line: 30

                      
        Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
        Assert.assertTrue(entity.getId() == entity2.getId());
        Assert.assertEquals(entity.getName(), entity2.getName());
    }

    public static class Entity {

        private final float    id;

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/BooleanFieldTest3.java
6 issues
JUnit 4 tests that execute tests should use the @Test annotation, JUnit 5 tests should use @Test, @RepeatedTest, @TestFactory, @TestTemplate or @ParameterizedTest
Design

Line: 12

               */
public class BooleanFieldTest3 extends TestCase {

    public void test_model() throws Exception {
        Model model = new Model();

        String text = JSON.toJSONString(model);
        Assert.assertEquals("{\"ok\":true,\"ok2\":true,\"ok3\":true}", text);
    }

            

Reported by PMD.

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

Line: 19

                      Assert.assertEquals("{\"ok\":true,\"ok2\":true,\"ok3\":true}", text);
    }

    public static class Model {

        private Long fail;

        private boolean ok;


            

Reported by PMD.

Avoid unused private fields such as 'fail'.
Design

Line: 21

              
    public static class Model {

        private Long fail;

        private boolean ok;

        private Boolean ok2;


            

Reported by PMD.

Avoid unused private fields such as 'ok'.
Design

Line: 23

              
        private Long fail;

        private boolean ok;

        private Boolean ok2;

        private boolean ok3;


            

Reported by PMD.

Avoid unused private fields such as 'ok2'.
Design

Line: 25

              
        private boolean ok;

        private Boolean ok2;

        private boolean ok3;

        public Long isFail() {
            return 1L;

            

Reported by PMD.

Avoid unused private fields such as 'ok3'.
Design

Line: 27

              
        private Boolean ok2;

        private boolean ok3;

        public Long isFail() {
            return 1L;
        }


            

Reported by PMD.