The following issues were found

src/test/java/com/alibaba/json/bvt/support/spring/mock/testcase/FastJsonHttpMessageConverterCase2Test.java
22 issues
Avoid unused private fields such as 'APPLICATION_JAVASCRIPT'.
Design

Line: 37

              @WebAppConfiguration
@ContextConfiguration
public class FastJsonHttpMessageConverterCase2Test {
    private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

            

Reported by PMD.

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

Line: 40

                  private static final MediaType APPLICATION_JAVASCRIPT = new MediaType("application", "javascript");

    @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc

            

Reported by PMD.

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

Line: 42

                  @Autowired
    private WebApplicationContext wac;

    private MockMvc mockMvc;

    @ComponentScan(basePackages = "com.alibaba.json.bvt.support.spring.mock.controller")
    @EnableWebMvc
    @Configuration
    protected static class Config extends WebMvcConfigurerAdapter {

            

Reported by PMD.

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

Line: 74

                  }

    @Test
    public void isInjectComponent() {
        wac.getBean(JSONPResponseBodyAdvice.class);
        wac.getBean(FastJsonViewResponseBodyAdvice.class);
    }

    @Test

            

Reported by PMD.

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

Line: 80

                  }

    @Test
    public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }


            

Reported by PMD.

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

Line: 81

              
    @Test
    public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

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

Line: 81

              
    @Test
    public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }

    @Test

            

Reported by PMD.

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

Line: 82

                  @Test
    public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test8_2() throws Exception {

            

Reported by PMD.

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

Line: 82

                  @Test
    public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test8_2() throws Exception {

            

Reported by PMD.

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

Line: 83

                  public void test8() throws Exception {
        mockMvc.perform(
                (post("/jsonp-fastjsonview/test8").characterEncoding("UTF-8")
                        .contentType(FastJsonHttpMessageConverter.APPLICATION_JAVASCRIPT))).andExpect(status().isOk()).andDo(print());
    }

    @Test
    public void test8_2() throws Exception {
//        ResultActions actions = mockMvc.perform((post("/jsonp-fastjsonview/test8?callback=fnUpdateSome").characterEncoding(

            

Reported by PMD.

src/main/java/com/alibaba/fastjson/parser/deserializer/NumberDeserializer.java
22 issues
Do not use the short type
Performance

Line: 61

                          if (clazz == short.class || clazz == Short.class) {
                BigDecimal val = lexer.decimalValue();
                lexer.nextToken(JSONToken.COMMA);
                short shortValue = TypeUtils.shortValue(val);
                return (T) Short.valueOf(shortValue);
            }

            if (clazz == byte.class || clazz == Byte.class) {
                BigDecimal val = lexer.decimalValue();

            

Reported by PMD.

The class 'NumberDeserializer' has a Modified Cyclomatic Complexity of 12 (Highest = 23).
Design

Line: 13

              import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;

public class NumberDeserializer implements ObjectDeserializer {

    public final static NumberDeserializer instance = new NumberDeserializer();

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

            

Reported by PMD.

The class 'NumberDeserializer' has a Standard Cyclomatic Complexity of 12 (Highest = 23).
Design

Line: 13

              import com.alibaba.fastjson.parser.JSONToken;
import com.alibaba.fastjson.util.TypeUtils;

public class NumberDeserializer implements ObjectDeserializer {

    public final static NumberDeserializer instance = new NumberDeserializer();

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

            

Reported by PMD.

The method 'deserialze(DefaultJSONParser, Type, Object)' has an NPath complexity of 7955200, current threshold is 200
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

The method 'deserialze' has a Modified Cyclomatic Complexity of 23.
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

The method 'deserialze' has a Standard Cyclomatic Complexity of 23.
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

The method 'deserialze(DefaultJSONParser, Type, Object)' has a NCSS line count of 66.
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

The method 'deserialze(DefaultJSONParser, Type, Object)' has a cyclomatic complexity of 41.
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

Avoid really long methods.
Design

Line: 18

                  public final static NumberDeserializer instance = new NumberDeserializer();

    @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);

            

Reported by PMD.

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

Line: 20

                  @SuppressWarnings("unchecked")
    public <T> T deserialze(DefaultJSONParser parser, Type clazz, Object fieldName) {
        final JSONLexer lexer = parser.lexer;
        if (lexer.token() == JSONToken.LITERAL_INT) {
            if (clazz == double.class || clazz  == Double.class) {
                String val = lexer.numberString();
                lexer.nextToken(JSONToken.COMMA);
                return (T) Double.valueOf(Double.parseDouble(val));
            }

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/date/DateTest4_indian.java
22 issues
JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 12

              import java.util.TimeZone;

public class DateTest4_indian extends TestCase {
    protected void setUp() throws Exception {
        JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
        JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() 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: 17

                      JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();

            

Reported by PMD.

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

Line: 17

                      JSON.defaultLocale = Locale.CHINA;
    }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();

            

Reported by PMD.

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

Line: 18

                  }

    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 19

              
    public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();


            

Reported by PMD.

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

Line: 20

                  public void test_date() throws Exception {
        Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();

            

Reported by PMD.

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

Line: 21

                      Date date1 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0530\"}", VO.class).getGmtCreate();
        assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(1800000, delta_2_1);

            

Reported by PMD.

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

Line: 22

                      assertNotNull(date1);
        Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(1800000, delta_2_1);


            

Reported by PMD.

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

Line: 23

                      Date date2 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0500\"}", VO.class).getGmtCreate();
        Date date3 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+0545\"}", VO.class).getGmtCreate();
        Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(1800000, delta_2_1);

        long delta_3_1 = date3.getTime() - date1.getTime();

            

Reported by PMD.

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

Line: 25

                      Date date4 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1245\"}", VO.class).getGmtCreate();
        Date date5 = JSON.parseObject("{\"gmtCreate\":\"2018-09-11T21:29:34+1345\"}", VO.class).getGmtCreate();

        long delta_2_1 = date2.getTime() - date1.getTime();
        assertEquals(1800000, delta_2_1);

        long delta_3_1 = date3.getTime() - date1.getTime();
        assertEquals(-900000, delta_3_1);


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/issue_2700/Issue2754.java
22 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.TimeZone;

public class Issue2754 extends TestCase {
    public void test_for_issue0() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));

            

Reported by PMD.

The String literal 'yyyy-MM-dd'T'HH:mm:ssXXX' appears 5 times in this file; the first occurrence is on line 15
Error

Line: 15

                      String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue1() throws Exception {

            

Reported by PMD.

When instantiating a SimpleDateFormat object, specify a Locale
Error

Line: 15

                      String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue1() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

              
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue1() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

            

Reported by PMD.

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

Line: 17

              
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Pacific/Chatham"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue1() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

            

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

                      assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue1() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));

            

Reported by PMD.

When instantiating a SimpleDateFormat object, specify a Locale
Error

Line: 24

                      String s = "{\"p1\":\"2019-09-18T20:35:00+12:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue2() throws Exception {

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

              
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue2() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
        C c = JSON.parseObject(s, C.class);

            

Reported by PMD.

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

Line: 26

              
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("NZ-CHAT"));
        assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue2() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
        C c = JSON.parseObject(s, C.class);

            

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

                      assertEquals("2019-09-18T20:35:00+12:45", sdf.format(c.p1.getTime()));
    }

    public void test_for_issue2() throws Exception {
        String s = "{\"p1\":\"2019-09-18T20:35:00+05:45\"}";
        C c = JSON.parseObject(s, C.class);

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
        sdf.setTimeZone(TimeZone.getTimeZone("Asia/Kathmandu"));

            

Reported by PMD.

src/test/java/com/alibaba/json/test/benchmark/BenchmarkExecutor.java
22 issues
Avoid throwing raw exception types.
Design

Line: 124

              
            return (Long) mbeanServer.getAttribute(objectName, "CollectionCount");
        } catch (Exception e) {
            throw new RuntimeException("error");
        }
    }
    
    public long getYoungGCTime() {
        try {

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 144

              
            return (Long) mbeanServer.getAttribute(objectName, "CollectionTime");
        } catch (Exception e) {
            throw new RuntimeException("error", e);
        }
    }

    public long getFullGC() {
        try {

            

Reported by PMD.

Avoid throwing raw exception types.
Design

Line: 165

              
            return (Long) mbeanServer.getAttribute(objectName, "CollectionCount");
        } catch (Exception e) {
            throw new RuntimeException("error");
        }
    }

    public static class Result {


            

Reported by PMD.

System.out.println is used
Design

Line: 46

                  }

    public void execute() {
    	System.out.println(System.getProperty("java.vm.name") + " " + System.getProperty("java.runtime.version"));
    	
        for (BenchmarkCase benchmarkCase : caseList) {
            for (Codec codec : codecList) {
                try {
                    benchmarkCase.init(codec);

            

Reported by PMD.

System.out.println is used
Design

Line: 61

                                  Result result = executeLoop(codec, benchmarkCase);
                    handleResult(codec, result);
                }
                System.out.println();
            }
        }
    }

    public void handleResult(Codec codec, Result result) {

            

Reported by PMD.

System.out.println is used
Design

Line: 72

                          return;
        }
        NumberFormat format = NumberFormat.getInstance();
        System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
                           + "\tYGCT " + result.getYoungGCTime());
    }

    private Result executeLoop(Codec codec, BenchmarkCase benchmarkCase) {
        long startMillis = System.currentTimeMillis();

            

Reported by PMD.

Avoid catching generic exceptions such as NullPointerException, RuntimeException, Exception in try-catch block
Design

Line: 52

                          for (Codec codec : codecList) {
                try {
                    benchmarkCase.init(codec);
                } catch (Exception e) {
                    e.printStackTrace();
                    break;
                }
                
                for (int i = 0; i < executeCount; ++i) {

            

Reported by PMD.

Avoid printStackTrace(); use a logger call instead.
Design

Line: 53

                              try {
                    benchmarkCase.init(codec);
                } catch (Exception e) {
                    e.printStackTrace();
                    break;
                }
                
                for (int i = 0; i < executeCount; ++i) {
                    Result result = executeLoop(codec, benchmarkCase);

            

Reported by PMD.

Avoid printStackTrace(); use a logger call instead.
Design

Line: 68

              
    public void handleResult(Codec codec, Result result) {
        if (result.getError() != null) {
            result.getError().printStackTrace();
            return;
        }
        NumberFormat format = NumberFormat.getInstance();
        System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
                           + "\tYGCT " + result.getYoungGCTime());

            

Reported by PMD.

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

Line: 68

              
    public void handleResult(Codec codec, Result result) {
        if (result.getError() != null) {
            result.getError().printStackTrace();
            return;
        }
        NumberFormat format = NumberFormat.getInstance();
        System.out.println(result.getName() + "\t" + codec.getName() + "\t" + format.format(result.getMillis()) + "\tYGC " + result.getYoungGC()
                           + "\tYGCT " + result.getYoungGCTime());

            

Reported by PMD.

src/test/java/com/alibaba/json/test/UTF8Test_decode.java
22 issues
System.out.println is used
Design

Line: 28

                  CharBuffer charBuffer;

    public void setUp() throws Exception {
        System.out.println(System.getProperty("java.runtime.version"));
    }


    public void test_encode() throws Exception {
        String text = new StringBuilder().append(T0).append(System.currentTimeMillis()).toString();

            

Reported by PMD.

System.out.println is used
Design

Line: 44

              //            f1(); // 695
//            f2(); // 975
            long millis = System.currentTimeMillis() - start;
            System.out.println("millis : " + millis);
        }
    }

    public void test_encode_en() throws Exception {
        String text = new StringBuilder().append(T1).append(System.currentTimeMillis()).toString();

            

Reported by PMD.

System.out.println is used
Design

Line: 60

              //            f1(); // 1296 1058
//            f2(); // 615 635
            long millis = System.currentTimeMillis() - start;
            System.out.println("millis : " + millis);
        }
    }

    private void f0() throws Exception {
        for (int i = 0; i < 1000 * 1000; ++i) {

            

Reported by PMD.

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

Line: 14

               * Created by wenshao on 24/07/2017.
 */
public class UTF8Test_decode extends TestCase {
    String T0 = "央视的报道《陆军第82集团军:聚合重塑 强军路上当先锋!》披露,从南昌起义到平江起义,从井冈山斗争到两万五千里长征,从首战平型关到历经三大战役,从穿插三所里到全歼美军北极熊团,22勇士飞夺泸定桥、18勇士强渡乌江、鏖战冀中“野八旅”、屡战屡胜“老虎连”、万岁军,一支支善战的部队,一个个滚烫的名字,熔铸成第82集团军新的灵魂。";
    String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";


    Charset charset = Charset.forName("UTF-8");


            

Reported by PMD.

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

Line: 15

               */
public class UTF8Test_decode extends TestCase {
    String T0 = "央视的报道《陆军第82集团军:聚合重塑 强军路上当先锋!》披露,从南昌起义到平江起义,从井冈山斗争到两万五千里长征,从首战平型关到历经三大战役,从穿插三所里到全歼美军北极熊团,22勇士飞夺泸定桥、18勇士强渡乌江、鏖战冀中“野八旅”、屡战屡胜“老虎连”、万岁军,一支支善战的部队,一个个滚烫的名字,熔铸成第82集团军新的灵魂。";
    String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";


    Charset charset = Charset.forName("UTF-8");



            

Reported by PMD.

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

Line: 18

                  String T1 = "Model and actress Emily Ratajkowski would you like you to know she has wonderful abs. We don’t know this because we’re psychic, but rather can surmise this desire from her many photos she posts on Instagram. Whether it’s due to genetics, diet, great Instagram techniques, or some combination of the above, the rising star takes ample opportunity to show you what she’s got, and her fans love it.";


    Charset charset = Charset.forName("UTF-8");


    char[] chars;
    byte[] bytes;


            

Reported by PMD.

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

Line: 21

                  Charset charset = Charset.forName("UTF-8");


    char[] chars;
    byte[] bytes;


    CharBuffer charBuffer;


            

Reported by PMD.

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

Line: 22

              

    char[] chars;
    byte[] bytes;


    CharBuffer charBuffer;

    public void setUp() throws Exception {

            

Reported by PMD.

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

Line: 25

                  byte[] bytes;


    CharBuffer charBuffer;

    public void setUp() throws Exception {
        System.out.println(System.getProperty("java.runtime.version"));
    }


            

Reported by PMD.

JUnit 4 tests that set up tests should use the @Before annotation, JUnit5 tests should use @BeforeEach or @BeforeAll
Design

Line: 27

              
    CharBuffer charBuffer;

    public void setUp() throws Exception {
        System.out.println(System.getProperty("java.runtime.version"));
    }


    public void test_encode() throws Exception {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest_private.java
22 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 BeanToArrayTest_private extends TestCase {

    public void test_beanToArray_parse() throws Exception {
        String text = "{\"go\":[[\"0\",[true,false],9999999999999,99,\"012345678901234567890123\",\"ftp://gfw.yma.co/x160\",\"xxxx\",\"9876543210123456\",[[\"m\",\"不要开心\",\"http://gfw.meiya.co\",\"123456@gg.com\",\"麻麻\",\"add\",null,\"9876543210123456\"]],null,[\"add\",\"ww\"],999,1234567890123]],\"success\":true}";
        GR result = JSON.parseObject(text, GR.class);
        Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);

            

Reported by PMD.

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

Line: 21

                      String text = "{\"go\":[[\"0\",[true,false],9999999999999,99,\"012345678901234567890123\",\"ftp://gfw.yma.co/x160\",\"xxxx\",\"9876543210123456\",[[\"m\",\"不要开心\",\"http://gfw.meiya.co\",\"123456@gg.com\",\"麻麻\",\"add\",null,\"9876543210123456\"]],null,[\"add\",\"ww\"],999,1234567890123]],\"success\":true}";
        GR result = JSON.parseObject(text, GR.class);
        Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);

            

Reported by PMD.

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

Line: 22

                      GR result = JSON.parseObject(text, GR.class);
        Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }

            

Reported by PMD.

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

Line: 22

                      GR result = JSON.parseObject(text, GR.class);
        Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }

            

Reported by PMD.

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

Line: 23

                      Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }


            

Reported by PMD.

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

Line: 23

                      Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }


            

Reported by PMD.

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

Line: 23

                      Assert.assertNotNull(result);
        Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }


            

Reported by PMD.

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

Line: 24

                      Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }

    public static class GR {

            

Reported by PMD.

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

Line: 24

                      Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }

    public static class GR {

            

Reported by PMD.

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

Line: 24

                      Assert.assertEquals(1, result.go.size());
        Assert.assertEquals("0", result.go.get(0).bi);
        Assert.assertEquals(true, result.go.get(0).co.qu);
        Assert.assertEquals(false, result.go.get(0).co.sa);
        Assert.assertEquals(9999999999999L, result.go.get(0).gm.getTime());
        Assert.assertEquals(99, result.go.get(0).grCo);
    }

    public static class GR {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_BrowserSecure.java
22 issues
JUnit tests should include assert() or fail()
Design

Line: 16

              
public class SerializeWriterTest_BrowserSecure extends TestCase {

    public void test_0() throws Exception {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");

            

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

              
public class SerializeWriterTest_BrowserSecure extends TestCase {

    public void test_0() throws Exception {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");

            

Reported by PMD.

StringBuffer (or StringBuilder).append is called 2 consecutive times with literals. Use a single append with a single combined String.
Performance

Line: 21

                      for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");
        JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
    }

    public void test_1() throws Exception {

            

Reported by PMD.

StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable.
Performance

Line: 21

                      for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");
        JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
    }

    public void test_1() throws Exception {

            

Reported by PMD.

Avoid appending characters as strings in StringBuffer.append.
Performance

Line: 22

                          buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");
        JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
    }

    public void test_1() throws Exception {
        StringBuilder buf = new StringBuilder();

            

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

                      JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
    }

    public void test_1() throws Exception {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");

            

Reported by PMD.

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

Line: 26

                      JSON.toJSONString(buf.toString(), SerializerFeature.BrowserSecure);
    }

    public void test_1() throws Exception {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");

            

Reported by PMD.

StringBuffer (or StringBuilder).append is called consecutively without reusing the target variable.
Performance

Line: 31

                      for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");

        StringWriter out = new StringWriter();
        JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
    }

            

Reported by PMD.

StringBuffer (or StringBuilder).append is called 2 consecutive times with literals. Use a single append with a single combined String.
Performance

Line: 31

                      for (int i = 0; i < 1024; ++i) {
            buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");

        StringWriter out = new StringWriter();
        JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
    }

            

Reported by PMD.

Avoid appending characters as strings in StringBuffer.append.
Performance

Line: 32

                          buf.append('a');
        }
        buf.append("中国");
        buf.append("\0");

        StringWriter out = new StringWriter();
        JSON.writeJSONStringTo(buf.toString(), out, SerializerFeature.BrowserSecure);
    }


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/JSONLexerTest_13.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: 11

              
public class JSONLexerTest_13 extends TestCase {

    public void test_e() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
    }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());

            

Reported by PMD.

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

Line: 12

              public class JSONLexerTest_13 extends TestCase {

    public void test_e() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
    }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }

            

Reported by PMD.

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

Line: 12

              public class JSONLexerTest_13 extends TestCase {

    public void test_e() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
    }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }

            

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

                      Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e3}}", A.class).getVo().getType());
    }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());

            

Reported by PMD.

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

Line: 16

                  }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }

            

Reported by PMD.

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

Line: 16

                  }

    public void test_E() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }

            

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

                      Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E3}}", A.class).getVo().getType());
    }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }
    
    public void test_E_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());

            

Reported by PMD.

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

Line: 20

                  }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }
    
    public void test_E_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
    }

            

Reported by PMD.

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

Line: 20

                  }
    
    public void test_e_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }
    
    public void test_E_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
    }

            

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

                      Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123e+3}}", A.class).getVo().getType());
    }
    
    public void test_E_plus() throws Exception {
        Assert.assertTrue(123e3D == JSON.parseObject("{\"vo\":{\"type\":123E+3}}", A.class).getVo().getType());
    }
    
    public void test_e_minus() throws Exception {
        Assert.assertTrue(123e-3D == JSON.parseObject("{\"vo\":{\"type\":123e-3}}", A.class).getVo().getType());

            

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.