The following issues were found

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

Line: 9

              
public class Issue2689 extends TestCase
{
    public void test_0() throws Exception {
        Exception error = null;
        try {
            JSON.parse("{\"val\":\"\\x~\"");
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      } catch (JSONException ex) {
            error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_1() throws Exception {
        Exception error = null;

            

Reported by PMD.

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

Line: 17

                          error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_1() throws Exception {
        Exception error = null;
        try {

            

Reported by PMD.

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

Line: 17

                          error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_1() throws Exception {
        Exception error = null;
        try {

            

Reported by PMD.

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

Line: 17

                          error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_1() throws Exception {
        Exception error = null;
        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: 20

                              error.getMessage().startsWith("invalid escape character"));
    }

    public void test_1() throws Exception {
        Exception error = null;
        try {
            JSON.parse("{\"val\":'\\x~'");
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 27

                      } catch (JSONException ex) {
            error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_2() throws Exception {
        Exception error = null;

            

Reported by PMD.

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

Line: 28

                          error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_2() throws Exception {
        Exception error = null;
        try {

            

Reported by PMD.

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

Line: 28

                          error = ex;
        }
        assertTrue(
                error.getMessage().startsWith("invalid escape character"));
    }

    public void test_2() throws Exception {
        Exception error = null;
        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: 31

                              error.getMessage().startsWith("invalid escape character"));
    }

    public void test_2() throws Exception {
        Exception error = null;
        try {
            JSON.parse("{\"val\":'\\x1'");
        } catch (JSONException ex) {
            error = ex;

            

Reported by PMD.

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

    public void test_list() throws Exception {
        String text = "{\"values\":[\"a\",\"b\",\"ab\\\\c\"]}";

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

            

Reported by PMD.

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

Line: 23

                      JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        
        Assert.assertEquals(3, model.values.size());
        Assert.assertTrue(model.values.contains("a"));
        Assert.assertTrue(model.values.contains("b"));
    }

    public void test_null() throws Exception {

            

Reported by PMD.

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

Line: 24

                      Model model = reader.readObject(Model.class);
        
        Assert.assertEquals(3, model.values.size());
        Assert.assertTrue(model.values.contains("a"));
        Assert.assertTrue(model.values.contains("b"));
    }

    public void test_null() throws Exception {
        String text = "{\"values\":null}";

            

Reported by PMD.

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

Line: 25

                      
        Assert.assertEquals(3, model.values.size());
        Assert.assertTrue(model.values.contains("a"));
        Assert.assertTrue(model.values.contains("b"));
    }

    public void test_null() throws Exception {
        String text = "{\"values\":null}";
        JSONReader reader = new JSONReader(new StringReader(text));

            

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.assertTrue(model.values.contains("b"));
    }

    public void test_null() throws Exception {
        String text = "{\"values\":null}";
        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertNull(model.values);
    }

            

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

                      Assert.assertNull(model.values);
    }

    public void test_empty() throws Exception {
        String text = "{\"values\":[]}";
        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertEquals(0, model.values.size());
    }

            

Reported by PMD.

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

Line: 39

                      String text = "{\"values\":[]}";
        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertEquals(0, model.values.size());
    }

    public void test_map_empty() throws Exception {
        String text = "{\"model\":{\"values\":[]}}";
        JSONReader reader = new JSONReader(new StringReader(text));

            

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(0, model.values.size());
    }

    public void test_map_empty() throws Exception {
        String text = "{\"model\":{\"values\":[]}}";
        JSONReader reader = new JSONReader(new StringReader(text));
        Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
        });
        Model model = (Model) map.get("model");

            

Reported by PMD.

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

Line: 48

                      Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
        });
        Model model = (Model) map.get("model");
        Assert.assertEquals(0, model.values.size());
    }

    public void test_notMatch() throws Exception {
        String text = "{\"value\":[]}";
        JSONReader reader = new JSONReader(new StringReader(text));

            

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

                      Assert.assertEquals(0, model.values.size());
    }

    public void test_notMatch() throws Exception {
        String text = "{\"value\":[]}";
        JSONReader reader = new JSONReader(new StringReader(text));
        Model model = reader.readObject(Model.class);
        Assert.assertNull(model.values);
    }

            

Reported by PMD.

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

    public void test_0() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[1,2]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(Type.B, model.value);
        Assert.assertEquals(Type.C, model.value1);

            

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

                      read.close();
    }
    
    public void test_1() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[\"A\",\"B\"]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(Type.A, model.value);
        Assert.assertEquals(Type.B, model.value1);

            

Reported by PMD.

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

Line: 33

                      read.close();
    }
    
    public void test_2() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[null,null]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(null, model.value);
        Assert.assertEquals(null, model.value1);

            

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

                      read.close();
    }
    
    public void test_error_1() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[null:null]"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 47

                      try {
            JSONReader read = new JSONReader(new StringReader("[null:null]"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_error_n() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[n"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 60

                      try {
            JSONReader read = new JSONReader(new StringReader("[n"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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_error_nu() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[nu"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 73

                      try {
            JSONReader read = new JSONReader(new StringReader("[nu"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_error_nul() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[nul"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_long.java
21 issues
System.out.println is used
Design

Line: 16

              public class JSONScannerTest_long extends TestCase {

    public void ftest_parse_long() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846476");
        lexer.scanNumber();
        Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
        Assert.assertEquals(1293770846476L, lexer.longValue());
    }

            

Reported by PMD.

Avoid instantiating Long objects.Call Long.valueOf() instead
Performance

Line: 19

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846476");
        lexer.scanNumber();
        Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
        Assert.assertEquals(1293770846476L, lexer.longValue());
    }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());

            

Reported by PMD.

System.out.println is used
Design

Line: 24

                  }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
    }

            

Reported by PMD.

Avoid instantiating Long objects.Call Long.valueOf() instead
Performance

Line: 27

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
    }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());

            

Reported by PMD.

System.out.println is used
Design

Line: 32

                  }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
    }

            

Reported by PMD.

Avoid instantiating Long objects.Call Long.valueOf() instead
Performance

Line: 35

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
    }

    public void test_error_0() {
        Exception error = null;

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 15

               */
public class JSONScannerTest_long extends TestCase {

    public void ftest_parse_long() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846476");
        lexer.scanNumber();
        Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
        Assert.assertEquals(1293770846476L, lexer.longValue());

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 23

                      Assert.assertEquals(1293770846476L, lexer.longValue());
    }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());

            

Reported by PMD.

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

Line: 31

                      Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
    }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
        Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());

            

Reported by PMD.

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

Line: 39

                      Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
    }

    public void test_error_0() {
        Exception error = null;
        try {
            JSONScanner lexer = new JSONScanner("--");
            lexer.scanNumber();
            lexer.longValue();

            

Reported by PMD.

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

    public void test_0() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[1,2]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(Type.B, model.value);
        Assert.assertEquals(Type.C, model.value1);

            

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

                      read.close();
    }
    
    public void test_1() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[\"A\",\"B\"]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(Type.A, model.value);
        Assert.assertEquals(Type.B, model.value1);

            

Reported by PMD.

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

Line: 33

                      read.close();
    }
    
    public void test_2() throws Exception {
        JSONReader read = new JSONReader(new StringReader("[null,null]"));
        read.config(Feature.SupportArrayToBean, true);
        Model model = read.readObject(Model.class);
        Assert.assertEquals(null, model.value);
        Assert.assertEquals(null, model.value1);

            

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

                      read.close();
    }
    
    public void test_error_1() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[null:null]"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 47

                      try {
            JSONReader read = new JSONReader(new StringReader("[null:null]"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_error_n() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[n"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 60

                      try {
            JSONReader read = new JSONReader(new StringReader("[n"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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_error_nu() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[nu"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

Avoid unused local variables such as 'model'.
Design

Line: 73

                      try {
            JSONReader read = new JSONReader(new StringReader("[nu"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);
            read.readObject(Model.class);
        } catch (JSONException ex) {
            error = ex;
        }
        Assert.assertNotNull(error);

            

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

                      Assert.assertNotNull(error);
    }
    
    public void test_error_nul() throws Exception {
        Exception error = null;
        try {
            JSONReader read = new JSONReader(new StringReader("[nul"));
            read.config(Feature.SupportArrayToBean, true);
            Model model = read.readObject(Model.class);

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_int.java
21 issues
System.out.println is used
Design

Line: 16

              public class JSONScannerTest_int extends TestCase {

    public void ftest_parse_long() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846");
        lexer.scanNumber();
        Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
        Assert.assertEquals(1293770846, lexer.intValue());
    }

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 19

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846");
        lexer.scanNumber();
        Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
        Assert.assertEquals(1293770846, lexer.intValue());
    }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());

            

Reported by PMD.

System.out.println is used
Design

Line: 24

                  }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
    }

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 27

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
    }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());

            

Reported by PMD.

System.out.println is used
Design

Line: 32

                  }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
    }

            

Reported by PMD.

Avoid instantiating Integer objects. Call Integer.valueOf() instead.
Performance

Line: 35

                      System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
    }

    public void test_error_0() {
        Exception error = null;

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 15

               */
public class JSONScannerTest_int extends TestCase {

    public void ftest_parse_long() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner("1293770846");
        lexer.scanNumber();
        Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
        Assert.assertEquals(1293770846, lexer.intValue());

            

Reported by PMD.

A method/constructor should not explicitly throw java.lang.Exception
Design

Line: 23

                      Assert.assertEquals(1293770846, lexer.intValue());
    }

    public void ftest_parse_long_1() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());

            

Reported by PMD.

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

Line: 31

                      Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
    }

    public void test_parse_long_2() throws Exception {
        System.out.println(System.currentTimeMillis());
        JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
        lexer.scanNumber();
        Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
        Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());

            

Reported by PMD.

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

Line: 39

                      Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
    }

    public void test_error_0() {
        Exception error = null;
        try {
            JSONScanner lexer = new JSONScanner("--");
            lexer.scanNumber();
            lexer.intValue();

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/bug/Bug_for_fushou.java
21 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 15

              
public class Bug_for_fushou extends TestCase{

	public void test_case1() {
		String text = "{\"modules\":{}}";
		L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
		});
		assertEquals(true, r1.getModules() instanceof L2);


            

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

	public void test_case1() {
		String text = "{\"modules\":{}}";
		L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
		});
		assertEquals(true, r1.getModules() instanceof L2);


            

Reported by PMD.

Use assertTrue(x)/assertFalse(x) instead of assertEquals(true, x)/assertEquals(false, x) or assertEquals(Boolean.TRUE, x)/assertEquals(Boolean.FALSE, x).
Design

Line: 19

              		String text = "{\"modules\":{}}";
		L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
		});
		assertEquals(true, r1.getModules() instanceof L2);

		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

              		String text = "{\"modules\":{}}";
		L1<?> r1 = JSONObject.parseObject(text, new TypeReference<L1<L2>>() {
		});
		assertEquals(true, r1.getModules() instanceof L2);

		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 23

              
		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";

            

Reported by PMD.

Use assertTrue(x)/assertFalse(x) instead of assertEquals(true, x)/assertEquals(false, x) or assertEquals(Boolean.TRUE, x)/assertEquals(Boolean.FALSE, x).
Design

Line: 23

              
		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";

            

Reported by PMD.

Use assertTrue(x)/assertFalse(x) instead of assertEquals(true, x)/assertEquals(false, x) or assertEquals(Boolean.TRUE, x)/assertEquals(Boolean.FALSE, x).
Design

Line: 24

              		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";
		L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 24

              		L1 r2 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(true, r2.getModules() instanceof JSONObject);
		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";
		L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {

            

Reported by PMD.

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

Line: 27

              		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";
		L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(JSONObject.class, r0.getModules().getClass());


            

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

              		assertEquals(false, r2.getModules() instanceof L2);
	}

	public void test_case2() {
		String text = "{\"modules\":{}}";
		L1<?> r0 = JSONObject.parseObject(text, new TypeReference<L1>() {
		});
		assertEquals(JSONObject.class, r0.getModules().getClass());


            

Reported by PMD.

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

              import junit.framework.TestCase;

public class BigStringFieldTest extends TestCase {
    public void test_bigFieldString() throws Exception {
        Model model = new Model();
        model.f0 = random(1024);
        model.f1 = random(1024);
        model.f2 = random(1024);
        model.f3 = random(1024);

            

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

                      Assert.assertEquals(model2.f4, model.f4);
    }
    
    public void test_list() throws Exception {
        List<Model> list = new ArrayList<Model>();
        for (int i = 0; i < 1000; ++i) {
            Model model = new Model();
            model.f0 = random(64);
            model.f1 = random(64);

            

Reported by PMD.

Avoid instantiating new objects inside loops
Performance

Line: 35

                  public void test_list() throws Exception {
        List<Model> list = new ArrayList<Model>();
        for (int i = 0; i < 1000; ++i) {
            Model model = new Model();
            model.f0 = random(64);
            model.f1 = random(64);
            model.f2 = random(64);
            model.f3 = random(64);
            model.f4 = random(64);

            

Reported by PMD.

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

Line: 47

                      List<Model> list2 = JSON.parseObject(text, new TypeReference<List<Model>>() {});
        Assert.assertEquals(list.size(), list2.size());
        for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }

            

Reported by PMD.

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

Line: 47

                      List<Model> list2 = JSON.parseObject(text, new TypeReference<List<Model>>() {});
        Assert.assertEquals(list.size(), list2.size());
        for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }

            

Reported by PMD.

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

Line: 48

                      Assert.assertEquals(list.size(), list2.size());
        for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }
    }

            

Reported by PMD.

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

Line: 48

                      Assert.assertEquals(list.size(), list2.size());
        for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }
    }

            

Reported by PMD.

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

Line: 49

                      for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }
    }
    

            

Reported by PMD.

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

Line: 49

                      for (int i = 0; i < 1000; ++i) {
            Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }
    }
    

            

Reported by PMD.

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

Line: 50

                          Assert.assertEquals(list.get(i).f0, list2.get(i).f0);    
            Assert.assertEquals(list.get(i).f1, list2.get(i).f1);    
            Assert.assertEquals(list.get(i).f2, list2.get(i).f2);    
            Assert.assertEquals(list.get(i).f3, list2.get(i).f3);    
            Assert.assertEquals(list.get(i).f4, list2.get(i).f4);    
        }
    }
    
    public String random(int count) {

            

Reported by PMD.

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

    public void test_0() throws Exception {
        Model object = new Model();
        object.value = "<script>alert(1);</script>";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);

            

Reported by PMD.

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

Line: 13

              
public class SerializeWriterTest_BrowserSecure_5_script_model extends TestCase {

    public void test_0() throws Exception {
        Model object = new Model();
        object.value = "<script>alert(1);</script>";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      object.value = "<script>alert(1);</script>";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
        Model object1 = JSON.parseObject(text, Model.class);
        assertEquals(object.value, object1.value);
    }

    public void test_1() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 20

              //        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003Ealert\\u00281\\u0029;\\u003C/script\\u003E\"}", text);
        Model object1 = JSON.parseObject(text, Model.class);
        assertEquals(object.value, object1.value);
    }

    public void test_1() throws Exception {
        Model object = new Model();
        object.value = "<";

            

Reported by PMD.

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

Line: 23

                      assertEquals(object.value, object1.value);
    }

    public void test_1() throws Exception {
        Model object = new Model();
        object.value = "<";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003C\"}", text);

            

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

                      assertEquals(object.value, object1.value);
    }

    public void test_1() throws Exception {
        Model object = new Model();
        object.value = "<";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003C\"}", text);

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

                      object.value = "<";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003C\"}", text);
        Model object1 = JSON.parseObject(text, Model.class);
        assertEquals(object.value, object1.value);
    }

    public void test_2() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 30

              //        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003C\"}", text);
        Model object1 = JSON.parseObject(text, Model.class);
        assertEquals(object.value, object1.value);
    }

    public void test_2() throws Exception {
        Model object = new Model();
        object.value = "<script>";

            

Reported by PMD.

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

Line: 33

                      assertEquals(object.value, object1.value);
    }

    public void test_2() throws Exception {
        Model object = new Model();
        object.value = "<script>";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003E\"}", text);

            

Reported by PMD.

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

Line: 33

                      assertEquals(object.value, object1.value);
    }

    public void test_2() throws Exception {
        Model object = new Model();
        object.value = "<script>";
        String text = JSON.toJSONString(object, SerializerFeature.BrowserSecure);
//        assertEquals("{\"value\":\"&lt;script&gt;alert(1);&lt;\\/script&gt;\"}", text);
        assertEquals("{\"value\":\"\\u003Cscript\\u003E\"}", text);

            

Reported by PMD.

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

    public void test_list_in() throws Exception {
        JSONPath path = new JSONPath("[name in ('ljw2083')]");

        List<Entity> entities = new ArrayList<Entity>();
        entities.add(new Entity(1001, "ljw2083"));
        entities.add(new Entity(1002, "wenshao"));

            

Reported by PMD.

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

Line: 18

                      JSONPath path = new JSONPath("[name in ('ljw2083')]");

        List<Entity> entities = new ArrayList<Entity>();
        entities.add(new Entity(1001, "ljw2083"));
        entities.add(new Entity(1002, "wenshao"));
        entities.add(new Entity(1003, "yakolee"));
        entities.add(new Entity(1004, null));

        List<Object> result = (List<Object>) path.eval(entities);

            

Reported by PMD.

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

Line: 19

              
        List<Entity> entities = new ArrayList<Entity>();
        entities.add(new Entity(1001, "ljw2083"));
        entities.add(new Entity(1002, "wenshao"));
        entities.add(new Entity(1003, "yakolee"));
        entities.add(new Entity(1004, null));

        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(1, result.size());

            

Reported by PMD.

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

Line: 20

                      List<Entity> entities = new ArrayList<Entity>();
        entities.add(new Entity(1001, "ljw2083"));
        entities.add(new Entity(1002, "wenshao"));
        entities.add(new Entity(1003, "yakolee"));
        entities.add(new Entity(1004, null));

        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(1, result.size());
        Assert.assertSame(entities.get(0), result.get(0));

            

Reported by PMD.

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

Line: 24

                      entities.add(new Entity(1004, null));

        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(1, result.size());
        Assert.assertSame(entities.get(0), result.get(0));
    }
    
    public void test_list_not_in() throws Exception {
        JSONPath path = new JSONPath("[name not in ('ljw2083')]");

            

Reported by PMD.

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

Line: 25

              
        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(1, result.size());
        Assert.assertSame(entities.get(0), result.get(0));
    }
    
    public void test_list_not_in() throws Exception {
        JSONPath path = new JSONPath("[name not in ('ljw2083')]");
        

            

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.assertSame(entities.get(0), result.get(0));
    }
    
    public void test_list_not_in() throws Exception {
        JSONPath path = new JSONPath("[name not in ('ljw2083')]");
        
        List<Entity> entities = new ArrayList<Entity>();
        entities.add(new Entity(1001, "ljw2083"));
        entities.add(new Entity(1002, "wenshao"));

            

Reported by PMD.

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

Line: 38

                      entities.add(new Entity(1004, null));
        
        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(3, result.size());
        Assert.assertSame(entities.get(1), result.get(0));
        Assert.assertSame(entities.get(2), result.get(1));
        Assert.assertSame(entities.get(3), result.get(2));
    }
    

            

Reported by PMD.

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

Line: 39

                      
        List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(3, result.size());
        Assert.assertSame(entities.get(1), result.get(0));
        Assert.assertSame(entities.get(2), result.get(1));
        Assert.assertSame(entities.get(3), result.get(2));
    }
    
    public void test_list_in_2() throws Exception {

            

Reported by PMD.

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

Line: 40

                      List<Object> result = (List<Object>) path.eval(entities);
        Assert.assertEquals(3, result.size());
        Assert.assertSame(entities.get(1), result.get(0));
        Assert.assertSame(entities.get(2), result.get(1));
        Assert.assertSame(entities.get(3), result.get(2));
    }
    
    public void test_list_in_2() throws Exception {
        JSONPath path = new JSONPath("[name in ('ljw2083', 'yakolee')]");

            

Reported by PMD.