The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/asm/TestASM_Byte_0.java
2 issues
Line: 10
public class TestASM_Byte_0 extends TestCase {
public void test_asm() throws Exception {
V0 v = new V0();
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
Reported by PMD.
Line: 15
String text = JSON.toJSONString(v);
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v.getI(), v1.getI());
}
public static class V0 {
private Byte i = 12;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DoubleTest_custom.java
2 issues
Line: 15
public class DoubleTest_custom extends TestCase {
public void test_0() throws Exception {
SerializeConfig config = new SerializeConfig();
config.put(Double.class, new DoubleSerializer(new DecimalFormat("###.##")));
Assert.assertEquals("1.12", JSON.toJSONString(1.123456789D, config));
}
Reported by PMD.
Line: 21
Assert.assertEquals("1.12", JSON.toJSONString(1.123456789D, config));
}
public void test_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.put(Double.class, new DoubleSerializer("###.###"));
Assert.assertEquals("1.123", JSON.toJSONString(1.123456789D, config));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DupSetterTest2.java
2 issues
Line: 19
public class DupSetterTest2 extends TestCase {
public void testEnum() {
VO enumTest = new VO();
enumTest.setStatus(3);
String json = JSONObject.toJSONString(enumTest);
JSONObject.parseObject(json, VO.class);
}
Reported by PMD.
Line: 19
public class DupSetterTest2 extends TestCase {
public void testEnum() {
VO enumTest = new VO();
enumTest.setStatus(3);
String json = JSONObject.toJSONString(enumTest);
JSONObject.parseObject(json, VO.class);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DupSetterTest4.java
2 issues
Line: 20
public class DupSetterTest4 extends TestCase {
public void testDup() {
V1 vo = new V1();
vo.status = 3;
String json = JSONObject.toJSONString(vo);
JSONObject.parseObject(json, V1.class);
}
Reported by PMD.
Line: 20
public class DupSetterTest4 extends TestCase {
public void testDup() {
V1 vo = new V1();
vo.status = 3;
String json = JSONObject.toJSONString(vo);
JSONObject.parseObject(json, V1.class);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DupSetterTest5.java
2 issues
Line: 20
public class DupSetterTest5 extends TestCase {
public void testDup() {
V1 vo = new V1();
vo.status = 3;
String json = JSONObject.toJSONString(vo);
JSONObject.parseObject(json, V1.class);
}
Reported by PMD.
Line: 20
public class DupSetterTest5 extends TestCase {
public void testDup() {
V1 vo = new V1();
vo.status = 3;
String json = JSONObject.toJSONString(vo);
JSONObject.parseObject(json, V1.class);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMappingErrorTest3.java
2 issues
Line: 14
public class ArrayMappingErrorTest3 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[1001,{}}", Model.class, Feature.SupportArrayToBean);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 15
public class ArrayMappingErrorTest3 extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[1001,{}}", Model.class, Feature.SupportArrayToBean);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/FontSerializerTest.java
2 issues
Line: 17
public class FontSerializerTest extends TestCase {
public void test_null() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Font.class).getClass());
VO vo = new VO();
Reported by PMD.
Line: 19
public void test_null() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Font.class).getClass());
VO vo = new VO();
Assert.assertEquals("{\"value\":null}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/InterfaceTest.java
2 issues
Line: 10
import com.alibaba.fastjson.annotation.JSONField;
public class InterfaceTest extends TestCase {
public void test_interface() throws Exception {
A a = new A();
a.setId(123);
a.setName("xasdf");
String text = JSON.toJSONString(a);
Reported by PMD.
Line: 19
Assert.assertEquals("{\"ID\":123,\"Name\":\"xasdf\"}", text);
}
public static class A implements IA, IB {
private int id;
private String name;
public int getId() {
return id;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest.java
2 issues
Line: 10
import com.alibaba.fastjson.annotation.JSONField;
public class JSONFieldTest extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.setId(123);
vo.setName("xx");
Reported by PMD.
Line: 20
Assert.assertEquals("{\"id\":123}", text);
}
public static class VO {
private int id;
@JSONField(serialize=false)
private String name;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest2.java
2 issues
Line: 10
import com.alibaba.fastjson.annotation.JSONField;
public class JSONFieldTest2 extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.setId(123);
vo.setFlag(true);
Reported by PMD.
Line: 20
Assert.assertEquals("{\"id\":123}", text);
}
public static class VO {
private int id;
@JSONField(serialize = false)
private boolean flag;
Reported by PMD.