The following issues were found

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

Line: 14

              import com.alibaba.fastjson.TypeReference;

public class JSONReader_typeRef extends TestCase {
    public void test_array() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[{\"id\":123}]"));
        
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {}.getType());
        
        Assert.assertEquals(123, list.get(0).getId());

            

Reported by PMD.

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

Line: 19

                      
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {}.getType());
        
        Assert.assertEquals(123, list.get(0).getId());
        
        reader.close();
    }
    
    public void test_array_1() throws Exception {

            

Reported by PMD.

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

Line: 24

                      reader.close();
    }
    
    public void test_array_1() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[{\"id\":123}]]"));
        
        reader.startArray();
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {}.getType());
        

            

Reported by PMD.

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

Line: 30

                      reader.startArray();
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {}.getType());
        
        Assert.assertEquals(123, list.get(0).getId());
        
        reader.endArray();
        
        reader.close();
    }

            

Reported by PMD.

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

Line: 37

                      reader.close();
    }
    
    public void test_array_2() throws Exception {
        JSONReader reader = new JSONReader(new StringReader("[[{\"id\":123}]]"));
        
        reader.startArray();
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {});
        

            

Reported by PMD.

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

Line: 43

                      reader.startArray();
        List<VO> list = reader.readObject(new TypeReference<List<VO>>() {});
        
        Assert.assertEquals(123, list.get(0).getId());
        
        reader.endArray();
        
        reader.close();
    }

            

Reported by PMD.

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

Line: 16

              
public class CollectionSerializerTest extends TestCase {

    public void test_0() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        listSerializer.write(new JSONSerializer(out), Collections.EMPTY_LIST, null, null, 0);


            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("[]", out.toString());
    }

    public void test_1() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        listSerializer.write(new JSONSerializer(out), Collections.singletonList(1), null, null, 0);


            

Reported by PMD.

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

Line: 34

                      Assert.assertEquals("[1]", out.toString());
    }

    public void test_2_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        List<Object> list = new ArrayList<Object>();
        list.add(1);

            

Reported by PMD.

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

Line: 46

                      Assert.assertEquals("[1,2]", out.toString());
    }

    public void test_3_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        List<Object> list = new ArrayList<Object>();
        list.add(1);

            

Reported by PMD.

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

Line: 59

                      Assert.assertEquals("[1,2,3]", out.toString());
    }

    public void test_4_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

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

                      Assert.assertEquals("[1,2,3,{}]", out.toString());
    }

    public void test_5_s() throws Exception {
        SerializeWriter out = new SerializeWriter();

        CollectionCodec listSerializer = new CollectionCodec();
        List<Object> list = new ArrayList<Object>();
        list.add(1L);

            

Reported by PMD.

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

Line: 16

              
public class ColorSerializerTest extends TestCase {

    public void test_null() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());

        VO vo = new VO();


            

Reported by PMD.

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

Line: 18

              
    public void test_null() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());

        VO vo = new VO();

        Assert.assertEquals("{\"value\":null}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
    }

            

Reported by PMD.

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

Line: 25

                      Assert.assertEquals("{\"value\":null}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
    }

    public void test_rgb() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());

        VO vo = new VO();
        vo.setValue(new Color(1,1,1,0));

            

Reported by PMD.

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

Line: 27

              
    public void test_rgb() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Color.class).getClass());

        VO vo = new VO();
        vo.setValue(new Color(1,1,1,0));

        Assert.assertEquals("{\"value\":{\"r\":1,\"g\":1,\"b\":1}}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));

            

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.assertEquals("{\"value\":{\"r\":1,\"g\":1,\"b\":1}}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
    }
    
    public void test_rgb_getAutowiredFor() throws Exception {
        
    }

    private static class VO {


            

Reported by PMD.

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

Line: 35

                      Assert.assertEquals("{\"value\":{\"r\":1,\"g\":1,\"b\":1}}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
    }
    
    public void test_rgb_getAutowiredFor() throws Exception {
        
    }

    private static class VO {


            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_BigDecimal.java
6 issues
System.out.println is used
Design

Line: 39

                      V1 v = new V1();
        v.setId(123);
        String text = JSON.toJSONString(v, SerializerFeature.UseSingleQuotes, SerializerFeature.WriteMapNullValue);
        System.out.println(text);
        
        Assert.assertEquals("{'decimal':null,'id':123}", text);
    }

    public static class V0 {

            

Reported by PMD.

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

Line: 13

              
public class TestASM_BigDecimal extends TestCase {

    public void test_decimal() throws Exception {
        V0 v = new V0();
        String text = JSON.toJSONString(v, SerializerFeature.UseSingleQuotes);
        Assert.assertEquals("{}", 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: 19

                      Assert.assertEquals("{}", text);
    }

    public void test_decimal_1() throws Exception {
        V0 v = new V0();
        v.setDecimal(new BigDecimal("123"));
        String text = JSON.toJSONString(v, SerializerFeature.UseSingleQuotes);
        Assert.assertEquals("{'decimal':123}", 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: 27

                  }
    

    public void test_decimal_2() throws Exception {
        V1 v = new V1();
        v.setId(123);
        String text = JSON.toJSONString(v, SerializerFeature.UseSingleQuotes);

        Assert.assertEquals("{'id':123}", 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: 35

                      Assert.assertEquals("{'id':123}", text);
    }
    
    public void test_decimal_3() throws Exception {
        V1 v = new V1();
        v.setId(123);
        String text = JSON.toJSONString(v, SerializerFeature.UseSingleQuotes, SerializerFeature.WriteMapNullValue);
        System.out.println(text);
        

            

Reported by PMD.

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

Line: 58

              
    }

    public static class V1 {

        private int        id;
        private BigDecimal decimal;

        public int getId() {

            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/support/spring/security/DefaultOAuth2AccessTokenTest.java
6 issues
Unit tests should not contain more than 1 assert(s).
Design

Line: 11

              import java.util.Date;

public class DefaultOAuth2AccessTokenTest extends TestCase {
    public void test_0() throws Exception {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("123");
        token.setExpiration(new Date());
        String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());

            

Reported by PMD.

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

Line: 11

              import java.util.Date;

public class DefaultOAuth2AccessTokenTest extends TestCase {
    public void test_0() throws Exception {
        DefaultOAuth2AccessToken token = new DefaultOAuth2AccessToken("123");
        token.setExpiration(new Date());
        String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());

            

Reported by PMD.

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

Line: 16

                      token.setExpiration(new Date());
        String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());
        assertEquals(token.getExpiration(), token2.getExpiration());
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 16

                      token.setExpiration(new Date());
        String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());
        assertEquals(token.getExpiration(), token2.getExpiration());
    }
}

            

Reported by PMD.

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

Line: 17

                      String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());
        assertEquals(token.getExpiration(), token2.getExpiration());
    }
}

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 17

                      String json = JSON.toJSONString(token, SerializerFeature.WriteClassName);
        DefaultOAuth2AccessToken token2 = (DefaultOAuth2AccessToken) JSON.parse(json);
        assertEquals(token.getValue(), token2.getValue());
        assertEquals(token.getExpiration(), token2.getExpiration());
    }
}

            

Reported by PMD.

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

Line: 18

              import junit.framework.TestCase;

public class DateFormatSerializerTest 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: 23

                      JSON.defaultLocale = Locale.CHINA;
    }
    
    public void test_date() throws Exception {
        Assert.assertEquals("{\"format\":null}", JSON.toJSONString(new VO(), SerializerFeature.WriteMapNullValue));
    }

    public void test_date_2() throws Exception {
        SerializeWriter out = new SerializeWriter();

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals("{\"format\":null}", JSON.toJSONString(new VO(), SerializerFeature.WriteMapNullValue));
    }

    public void test_date_2() throws Exception {
        SerializeWriter out = new SerializeWriter();
        SerializeConfig config = new SerializeConfig();
        JSONSerializer serializer = new JSONSerializer(out, config);

        serializer.config(SerializerFeature.WriteMapNullValue, true);

            

Reported by PMD.

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

Line: 38

                      Assert.assertEquals("{\"format\":null}", out.toString());
    }

    public void test_date_3() throws Exception {
        SerializeWriter out = new SerializeWriter();
        SerializeConfig config = new SerializeConfig();
        JSONSerializer serializer = new JSONSerializer(out, config);

        serializer.config(SerializerFeature.WriteClassName, true);

            

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

                                          out.toString());
    }

    public void test_date_4() throws Exception {
        SerializeWriter out = new SerializeWriter();
        SerializeConfig config = new SerializeConfig();
        JSONSerializer serializer = new JSONSerializer(out, config);

        SimpleDateFormat format = new SimpleDateFormat("yyyy");

            

Reported by PMD.

When instantiating a SimpleDateFormat object, specify a Locale
Error

Line: 55

                      SerializeConfig config = new SerializeConfig();
        JSONSerializer serializer = new JSONSerializer(out, config);

        SimpleDateFormat format = new SimpleDateFormat("yyyy");
        format.setTimeZone(JSON.defaultTimeZone);
        serializer.write(new VO(format));

        Assert.assertEquals("{\"format\":\"yyyy\"}", out.toString());
        

            

Reported by PMD.

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

Line: 14

              import junit.framework.TestCase;

public class BigListStringFieldTest extends TestCase {
    public void test_list() throws Exception {
        Model model = new Model();
        model.values = new ArrayList<String>(10000);
        for (int i = 0; i < 10000; ++i) {
            String value = random(100);
            model.values.add(value);

            

Reported by PMD.

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

Line: 19

                      model.values = new ArrayList<String>(10000);
        for (int i = 0; i < 10000; ++i) {
            String value = random(100);
            model.values.add(value);
        }
        String text = JSON.toJSONString(model);
        Model model2 = JSON.parseObject(text, Model.class);
        
        Assert.assertEquals(model.values, model2.values);

            

Reported by PMD.

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

Line: 27

                      Assert.assertEquals(model.values, model2.values);
    }
    public static class Model {
        public List<String> values;
    }
    
    public String random(int count) {
        Random random = new Random();
        

            

Reported by PMD.

Found 'DU'-anomaly for variable 'random' (lines '31'-'39').
Error

Line: 31

                  }
    
    public String random(int count) {
        Random random = new Random();
        
        char[] chars = new char[count];
        for (int i = 0; i < count; ++i) {
            chars[i] = (char) random.nextInt();
        }

            

Reported by PMD.

Found 'DD'-anomaly for variable 'chars' (lines '33'-'35').
Error

Line: 33

                  public String random(int count) {
        Random random = new Random();
        
        char[] chars = new char[count];
        for (int i = 0; i < count; ++i) {
            chars[i] = (char) random.nextInt();
        }
        
        return new String(chars);

            

Reported by PMD.

Found 'DD'-anomaly for variable 'chars' (lines '35'-'35').
Error

Line: 35

                      
        char[] chars = new char[count];
        for (int i = 0; i < count; ++i) {
            chars[i] = (char) random.nextInt();
        }
        
        return new String(chars);
    }
}

            

Reported by PMD.

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

Line: 9

              import junit.framework.TestCase;

public class Issue1633 extends TestCase {
    public void test_for_issue_int() throws Exception {
        String text = "{123:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("123"));
    }


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 12

                  public void test_for_issue_int() throws Exception {
        String text = "{123:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("123"));
    }

    public void test_for_issue_bool() throws Exception {
        String text = "{false:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);

            

Reported by PMD.

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

Line: 12

                  public void test_for_issue_int() throws Exception {
        String text = "{123:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("123"));
    }

    public void test_for_issue_bool() throws Exception {
        String text = "{false:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);

            

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

                      assertEquals("abc", obj.getString("123"));
    }

    public void test_for_issue_bool() throws Exception {
        String text = "{false:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("false"));
    }
}
            

Reported by PMD.

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

Line: 18

                  public void test_for_issue_bool() throws Exception {
        String text = "{false:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("false"));
    }
}
            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                  public void test_for_issue_bool() throws Exception {
        String text = "{false:\"abc\"}";
        JSONObject obj = JSON.parseObject(text, Feature.NonStringKeyAsString);
        assertEquals("abc", obj.getString("false"));
    }
}
            

Reported by PMD.

src/test/java/com/alibaba/json/bvt/date/DateTest2.java
6 issues
Found non-transient, non-static member. Please mark as transient or provide accessors.
Error

Line: 12

              import java.util.TimeZone;

public class DateTest2 extends TestCase {
    private TimeZone timeZone;
    protected void setUp() throws Exception {
        timeZone = JSON.defaultTimeZone;
    }

    protected void tearDown() throws Exception {

            

Reported by PMD.

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

Line: 13

              
public class DateTest2 extends TestCase {
    private TimeZone timeZone;
    protected void setUp() throws Exception {
        timeZone = JSON.defaultTimeZone;
    }

    protected void tearDown() throws Exception {
        JSON.defaultTimeZone = timeZone;

            

Reported by PMD.

JUnit 4 tests that clean up tests should use the @After annotation, JUnit5 tests should use @AfterEach or @AfterAll
Design

Line: 17

                      timeZone = JSON.defaultTimeZone;
    }

    protected void tearDown() throws Exception {
        JSON.defaultTimeZone = timeZone;
    }

    public void test_date() throws Exception {
        JSON.defaultTimeZone = TimeZone.getTimeZone("America/Chicago");

            

Reported by PMD.

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

Line: 21

                      JSON.defaultTimeZone = timeZone;
    }

    public void test_date() throws Exception {
        JSON.defaultTimeZone = TimeZone.getTimeZone("America/Chicago");
        Date date = new Date(1531928656055L);
        TestBean bean = new TestBean();
        bean.setDate(date);


            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 28

                      bean.setDate(date);

        String iso = JSON.toJSONString(bean, SerializerFeature.UseISO8601DateFormat);
        assertEquals("{\"date\":\"2018-07-18T10:44:16.055-05:00\"}", iso);
    }

    public static class TestBean {
        private Date date;


            

Reported by PMD.

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

Line: 6

              import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import org.junit.Assert;

import java.util.Date;
import java.util.TimeZone;

public class DateTest2 extends TestCase {

            

Reported by PMD.

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

Line: 13

              import java.util.Map;

public class Issue1628 extends TestCase {
    public void test_toJSONBytes() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, new SimplePropertyPreFilter("a"));
        assertEquals("{\"a\":1001}", new String(bytes));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 18

                      map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, new SimplePropertyPreFilter("a"));
        assertEquals("{\"a\":1001}", new String(bytes));
    }

    public void test_toJSONBytes_1() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 1001);

            

Reported by PMD.

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

Line: 21

                      assertEquals("{\"a\":1001}", new String(bytes));
    }

    public void test_toJSONBytes_1() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, new SerializeFilter[] {new SimplePropertyPreFilter("a")});
        assertEquals("{\"a\":1001}", new String(bytes));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 26

                      map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, new SerializeFilter[] {new SimplePropertyPreFilter("a")});
        assertEquals("{\"a\":1001}", new String(bytes));
    }

    public void test_toJSONBytes_2() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 1001);

            

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("{\"a\":1001}", new String(bytes));
    }

    public void test_toJSONBytes_2() throws Exception {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, SerializeConfig.globalInstance, new SimplePropertyPreFilter("a"));
        assertEquals("{\"a\":1001}", new String(bytes));

            

Reported by PMD.

JUnit assertions should include a message
Design

Line: 34

                      map.put("a", 1001);
        map.put("b", 2002);
        byte[] bytes = JSON.toJSONBytes(map, SerializeConfig.globalInstance, new SimplePropertyPreFilter("a"));
        assertEquals("{\"a\":1001}", new String(bytes));
    }
}

            

Reported by PMD.