The following issues were found
src/test/java/com/alibaba/json/bvt/LongFieldTest_4_stream.java
3 issues
Line: 19
public class LongFieldTest_4_stream extends TestCase {
public void test_min() throws Exception {
Random random = new Random();
Model[] array = new Model[2048];
for (int i = 0; i < array.length; ++i) {
array[i] = new Model();
array[i].value = random.nextLong();
Reported by PMD.
Line: 42
@JSONType(serialzeFeatures = SerializerFeature.BeanToArray, parseFeatures = Feature.SupportArrayToBean)
public static class Model {
public long value;
}
}
Reported by PMD.
Line: 20
public class LongFieldTest_4_stream extends TestCase {
public void test_min() throws Exception {
Random random = new Random();
Model[] array = new Model[2048];
for (int i = 0; i < array.length; ++i) {
array[i] = new Model();
array[i].value = random.nextLong();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/BigDecimalFieldTest.java
3 issues
Line: 14
public class BigDecimalFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 25
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 28
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/MapRefTest.java
3 issues
Line: 29
text = JSON.toJSONString(map);
}
System.out.println(text);
Map<String, Object> map = JSON.parseObject(text, new TypeReference<Map<String, Object>>() {});
//Assert.assertEquals(map, map.get("this"));
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
Reported by PMD.
Line: 14
public class MapRefTest extends TestCase {
public void test_0() throws Exception {
String text;
{
Map<String, Object> map = new HashMap<String, Object>();
User user = new User();
Reported by PMD.
Line: 35
Assert.assertEquals(map.get("u1"), map.get("u2"));
}
public static class User {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/RectangleTest.java
3 issues
Line: 23
Rectangle v = new Rectangle(3, 4, 100, 200);
String text = JSON.toJSONString(v, SerializerFeature.WriteClassName);
System.out.println(text);
Rectangle v2 = (Rectangle) JSON.parse(text);
Assert.assertEquals(v, v2);
}
Reported by PMD.
Line: 16
public class RectangleTest extends TestCase {
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Rectangle.class).getClass());
Rectangle v = new Rectangle(3, 4, 100, 200);
String text = JSON.toJSONString(v, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 18
public void test_color() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Rectangle.class).getClass());
Rectangle v = new Rectangle(3, 4, 100, 200);
String text = JSON.toJSONString(v, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/SqlDateTest1.java
3 issues
Line: 16
import junit.framework.TestCase;
public class SqlDateTest1 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = new Locale("zh_CN");
}
public void test_date() throws Exception {
Reported by PMD.
Line: 21
JSON.defaultLocale = new Locale("zh_CN");
}
public void test_date() throws Exception {
long millis = 1324138987429L;
Date date = new Date(millis);
Assert.assertEquals("1324138987429", JSON.toJSONString(date));
Assert.assertEquals("{\"@type\":\"java.sql.Date\",\"val\":1324138987429}", JSON.toJSONString(date, SerializerFeature.WriteClassName));
Reported by PMD.
Line: 4
package com.alibaba.json.bvt;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.TimeZone;
import org.junit.Assert;
Reported by PMD.
src/test/java/com/alibaba/json/TestGC.java
3 issues
Line: 7
public class TestGC extends TestCase {
public void test_0 () throws Exception {
for (int i = 0; i < 1000 * 1000; ++i) {
StringBuilder buf = new StringBuilder(1000 * 1000 * 10);
buf.append(i);
Thread.sleep(10);
}
Reported by PMD.
Line: 7
public class TestGC extends TestCase {
public void test_0 () throws Exception {
for (int i = 0; i < 1000 * 1000; ++i) {
StringBuilder buf = new StringBuilder(1000 * 1000 * 10);
buf.append(i);
Thread.sleep(10);
}
Reported by PMD.
Line: 9
public class TestGC extends TestCase {
public void test_0 () throws Exception {
for (int i = 0; i < 1000 * 1000; ++i) {
StringBuilder buf = new StringBuilder(1000 * 1000 * 10);
buf.append(i);
Thread.sleep(10);
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/StringFieldTest.java
3 issues
Line: 13
public class StringFieldTest extends TestCase {
public void test_codec_null() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 27
V0 v1 = JSON.parseObject(text, V0.class, config, JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 30
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/StringFieldTest_special.java
3 issues
Line: 13
import junit.framework.TestCase;
public class StringFieldTest_special extends TestCase {
public void test_special() throws Exception {
Model model = new Model();
model.name = "a\\bc";
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"name\":\"a\\\\bc\"}", text);
Reported by PMD.
Line: 25
reader.close();
}
public void test_special_2() throws Exception {
Model model = new Model();
model.name = "a\\bc\"";
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"name\":\"a\\\\bc\\\"\"}", text);
Reported by PMD.
Line: 39
public static class Model {
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/StringFieldTest_special_reader.java
3 issues
Line: 10
import junit.framework.TestCase;
public class StringFieldTest_special_reader extends TestCase {
public void test_special() throws Exception {
Model model = new Model();
model.name = "a\\bc";
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"name\":\"a\\\\bc\"}", text);
Reported by PMD.
Line: 20
Assert.assertEquals(model.name, model2.name);
}
public void test_special_2() throws Exception {
Model model = new Model();
model.name = "a\\bc\"";
String text = JSON.toJSONString(model);
Assert.assertEquals("{\"name\":\"a\\\\bc\\\"\"}", text);
Reported by PMD.
Line: 32
public static class Model {
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/fastjson/serializer/issue3473/SerializeWriterJavaSqlDateTest.java
3 issues
Line: 26
*/
public class SerializeWriterJavaSqlDateTest {
private Map<String, Object> data = new HashMap<String, Object>(1, 1);
@Before
public void before() throws ParseException {
data.put("sqlDate", new Date(DateUtils.parseDate("2020-09-29", "yyyy-MM-dd")
.getTime()));
Reported by PMD.
Line: 26
*/
public class SerializeWriterJavaSqlDateTest {
private Map<String, Object> data = new HashMap<String, Object>(1, 1);
@Before
public void before() throws ParseException {
data.put("sqlDate", new Date(DateUtils.parseDate("2020-09-29", "yyyy-MM-dd")
.getTime()));
Reported by PMD.
Line: 30
@Before
public void before() throws ParseException {
data.put("sqlDate", new Date(DateUtils.parseDate("2020-09-29", "yyyy-MM-dd")
.getTime()));
}
@Test
public void yyyy_MM_dd_HH_mm_ss_test() {
Reported by PMD.