The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMappingErrorTest2.java
2 issues
Line: 14
public class ArrayMappingErrorTest2 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 ArrayMappingErrorTest2 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/parser/deser/arraymapping/ArrayMappingErrorTest.java
2 issues
Line: 13
public class ArrayMappingErrorTest extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[1001,2002]", Model.class, Feature.SupportArrayToBean);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 14
public class ArrayMappingErrorTest extends TestCase {
public void test_for_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[1001,2002]", Model.class, Feature.SupportArrayToBean);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/LocalTest.java
2 issues
Line: 12
public class LocalTest extends TestCase {
public void test_timezone() throws Exception {
String text = JSON.toJSONString(Locale.CHINA);
Assert.assertEquals(JSON.toJSONString(Locale.CHINA.toString()), text);
Locale locale = JSON.parseObject(text, Locale.class);
Reported by PMD.
Line: 15
public void test_timezone() throws Exception {
String text = JSON.toJSONString(Locale.CHINA);
Assert.assertEquals(JSON.toJSONString(Locale.CHINA.toString()), text);
Locale locale = JSON.parseObject(text, Locale.class);
Assert.assertEquals(Locale.CHINA, locale);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ObjectSerializerTest.java
2 issues
Line: 17
public class ObjectSerializerTest extends TestCase {
public void test_serialize() throws Exception {
SerializeConfig config = new SerializeConfig();
config.put(ResultCode.class, new ResultCodeSerilaizer());
Result result = new Result();
result.code = ResultCode.SIGN_ERROR;
Reported by PMD.
Line: 29
public static class Result {
public ResultCode code;
}
public static enum ResultCode {
SUCCESS(1), ERROR(-1), UNKOWN_ERROR(999), LOGIN_FAILURE(8), INVALID_ARGUMENT(0),
SIGN_ERROR(17);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/PascalNameFilterTest.java
2 issues
Line: 11
public class PascalNameFilterTest extends TestCase {
public void test_0() throws Exception {
JSONSerializer serializer = new JSONSerializer();
serializer.getNameFilters().add(new PascalNameFilter());
VO vo = new VO();
vo.setId(123);
Reported by PMD.
Line: 26
serializer.close();
}
public static class VO {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/PrePropertyFilterTest.java
2 issues
Line: 15
public void test_0() throws Exception {
class VO {
public int getId() { throw new RuntimeException(); }
}
PropertyPreFilter filter = new PropertyPreFilter () {
public boolean apply(JSONSerializer serializer, Object source, String name) {
return false;
Reported by PMD.
Line: 13
public class PrePropertyFilterTest extends TestCase {
public void test_0() throws Exception {
class VO {
public int getId() { throw new RuntimeException(); }
}
PropertyPreFilter filter = new PropertyPreFilter () {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/RectangleSerializerTest.java
2 issues
Line: 17
public class RectangleSerializerTest extends TestCase {
public void test_null() throws Exception {
JSONSerializer serializer = new JSONSerializer();
Assert.assertEquals(AwtCodec.class, serializer.getObjectWriter(Rectangle.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(Rectangle.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/SerializeWriterTest_17.java
2 issues
Line: 15
public class SerializeWriterTest_17 extends TestCase {
public void test_writer_1() throws Exception {
StringWriter strOut = new StringWriter();
SerializeWriter out = new SerializeWriter(strOut, 6);
out.config(SerializerFeature.QuoteFieldNames, true);
try {
Reported by PMD.
Line: 32
Assert.assertEquals("{\"value\":123456789}", strOut.toString());
}
public void test_direct() throws Exception {
SerializeWriter out = new SerializeWriter(6);
out.config(SerializerFeature.QuoteFieldNames, true);
try {
JSONSerializer serializer = new JSONSerializer(out);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_19.java
2 issues
Line: 16
public class SerializeWriterTest_19 extends TestCase {
public void test_writer_1() throws Exception {
SerializeWriter out = new SerializeWriter(14);
out.config(SerializerFeature.QuoteFieldNames, true);
out.config(SerializerFeature.UseSingleQuotes, true);
try {
JSONSerializer serializer = new JSONSerializer(out);
Reported by PMD.
Line: 24
JSONSerializer serializer = new JSONSerializer(out);
VO vo = new VO();
vo.getValues().add("#");
serializer.write(vo);
Assert.assertEquals("{'values':['#']}", out.toString());
} finally {
out.close();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_2.java
2 issues
Line: 13
@SuppressWarnings("deprecation")
public class SerializeWriterTest_2 extends TestCase {
public void test_0() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.config(SerializerFeature.WriteTabAsSpecial, true);
out.writeString("\t\n \b\n\r\f\\ \"");
Assert.assertEquals("\"\\t\\n \\b\\n\\r\\f\\\\ \\\"\"", out.toString());
out.close();
Reported by PMD.
Line: 21
out.close();
}
public void test_1() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.config(SerializerFeature.WriteTabAsSpecial, true);
out.config(SerializerFeature.UseSingleQuotes, true);
out.writeString("\t\n \b\n\r\f\\ \"");
Assert.assertEquals("'\\t\\n \\b\\n\\r\\f\\\\ \"'", out.toString());
Reported by PMD.