The following issues were found
src/test/java/com/alibaba/json/bvt/jdk8/ZonedDateTimeTest.java
3 issues
Line: 18
vo.setDate(ZonedDateTime.now());
String text = JSON.toJSONString(vo);
System.out.println(text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
Reported by PMD.
Line: 13
public class ZonedDateTimeTest extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
vo.setDate(ZonedDateTime.now());
String text = JSON.toJSONString(vo);
System.out.println(text);
Reported by PMD.
Line: 22
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
public static class VO {
private ZonedDateTime date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2300/Issue2341.java
3 issues
Line: 8
import junit.framework.TestCase;
public class Issue2341 extends TestCase {
public void test_for_issue() throws Exception {
String ss = "{\"@type\":\"1234\"}";
JSONObject object = JSON.parseObject(ss);
assertEquals("1234", object.get("@type"));
}
}
Reported by PMD.
Line: 11
public void test_for_issue() throws Exception {
String ss = "{\"@type\":\"1234\"}";
JSONObject object = JSON.parseObject(ss);
assertEquals("1234", object.get("@type"));
}
}
Reported by PMD.
Line: 11
public void test_for_issue() throws Exception {
String ss = "{\"@type\":\"1234\"}";
JSONObject object = JSON.parseObject(ss);
assertEquals("1234", object.get("@type"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/ZoneIdTest.java
3 issues
Line: 18
vo.setDate(ZoneId.of("Europe/Paris"));
String text = JSON.toJSONString(vo);
System.out.println(text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
Reported by PMD.
Line: 13
public class ZoneIdTest extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
vo.setDate(ZoneId.of("Europe/Paris"));
String text = JSON.toJSONString(vo);
System.out.println(text);
Reported by PMD.
Line: 22
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
public static class VO {
private ZoneId date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1400/Issue1474.java
3 issues
Line: 12
import java.util.Map;
public class Issue1474 extends TestCase {
public void test_for_issue() throws Exception {
Map<String,Object> extraData = new HashMap<String,Object>();
extraData.put("ext_1", null);
extraData.put("ext_2", null);
People p = new People();
Reported by PMD.
Line: 22
p.setName("顾客");
p.setExtraData(extraData);
assertEquals("{\"id\":\"001\",\"name\":\"顾客\"}", JSON.toJSONString(p));
}
@JSONType(asm = false)
static class People{
private String name;
Reported by PMD.
Line: 26
}
@JSONType(asm = false)
static class People{
private String name;
private String id;
@JSONField(unwrapped=true)
private Object extraData;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/PeriodTest.java
3 issues
Line: 18
vo.setDate(Period.of(3, 2, 11));
String text = JSON.toJSONString(vo);
System.out.println(text);
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
Reported by PMD.
Line: 13
public class PeriodTest extends TestCase {
public void test_for_issue() throws Exception {
VO vo = new VO();
vo.setDate(Period.of(3, 2, 11));
String text = JSON.toJSONString(vo);
System.out.println(text);
Reported by PMD.
Line: 22
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
public static class VO {
private Period date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/AsmParserTest0.java
3 issues
Line: 10
public class AsmParserTest0 extends TestCase {
public void test_asm() throws Exception {
A a = JSON.parseObject("{\"f1\":123}", A.class);
Assert.assertNotNull(a.getF2());
}
public static class A {
Reported by PMD.
Line: 12
public void test_asm() throws Exception {
A a = JSON.parseObject("{\"f1\":123}", A.class);
Assert.assertNotNull(a.getF2());
}
public static class A {
private int f1;
Reported by PMD.
Line: 15
Assert.assertNotNull(a.getF2());
}
public static class A {
private int f1;
private B f2 = new B();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/creator/JSONCreatorTest_default_int.java
3 issues
Line: 11
public class JSONCreatorTest_default_int extends TestCase {
public void test_create() throws Exception {
Model model = JSON.parseObject("{\"name\":\"wenshao\"}", Model.class);
Assert.assertEquals(0, model.id);
Assert.assertEquals("wenshao", model.name);
}
Reported by PMD.
Line: 20
public static class Model {
private final int id;
private final String name;
@JSONCreator
public Model(@JSONField(name="id") int id, @JSONField(name="name") String name) {
this.id = id;
Reported by PMD.
Line: 21
public static class Model {
private final int id;
private final String name;
@JSONCreator
public Model(@JSONField(name="id") int id, @JSONField(name="name") String name) {
this.id = id;
this.name = name;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest3.java
3 issues
Line: 14
public class BeanToArrayTest3 extends TestCase {
public void test_array() throws Exception {
Model model = new Model();
model.item = new Item();
model.item.id = 1001;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 29
public static class Model {
@JSONField(serialzeFeatures=SerializerFeature.BeanToArray, parseFeatures=Feature.SupportArrayToBean)
public Item item;
}
public static class Item {
public int id;
}
Reported by PMD.
Line: 33
}
public static class Item {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayTest3_private.java
3 issues
Line: 14
public class BeanToArrayTest3_private extends TestCase {
public void test_array() throws Exception {
Model model = new Model();
model.item = new Item();
model.item.id = 1001;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 29
private static class Model {
@JSONField(serialzeFeatures=SerializerFeature.BeanToArray, parseFeatures=Feature.SupportArrayToBean)
public Item item;
}
private static class Item {
public int id;
}
Reported by PMD.
Line: 33
}
private static class Item {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/BigSpecailStringTest.java
3 issues
Line: 12
import junit.framework.TestCase;
public class BigSpecailStringTest extends TestCase {
public void test_big_special_key() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Reported by PMD.
Line: 15
public void test_big_special_key() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Arrays.fill(chars, '0');
buf.append(chars);
}
Reported by PMD.
Line: 17
for (int i = 0; i < 16; ++i) {
buf.append('\\');
buf.append('\"');
char[] chars = new char[1024];
Arrays.fill(chars, '0');
buf.append(chars);
}
String text = buf.toString();
Reported by PMD.