The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumFieldsTest4.java
2 issues
Line: 11
import junit.framework.TestCase;
public class EnumFieldsTest4 extends TestCase {
public void test_enum() throws Exception {
Model model = new Model();
model.types = new Type[]{Type.A, null};
String text = JSON.toJSONString(model, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"types\":[\"A\",null]}", text);
Reported by PMD.
Line: 20
}
public static class Model {
public Type[] types;
}
private static enum Type {
A, B, C
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/enum_/EnumFieldsTest6.java
2 issues
Line: 11
import junit.framework.TestCase;
public class EnumFieldsTest6 extends TestCase {
public void test_enum() throws Exception {
Model model = new Model();
model.types = new Object[]{Type.A, null};
String text = JSON.toJSONString(model, SerializerFeature.WriteMapNullValue);
Assert.assertEquals("{\"types\":[\"A\",null]}", text);
Reported by PMD.
Line: 20
}
public static class Model {
public Object[] types;
}
private static enum Type {
A, B, C
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/exception/ExceptionTest.java
2 issues
Line: 10
* Created by wenshao on 29/01/2017.
*/
public class ExceptionTest extends TestCase {
public void test_exception() throws Exception {
IllegalAccessError ex = new IllegalAccessError();
String text = JSON.toJSONString(ex);
assertTrue(JSON.parse(text) instanceof IllegalAccessError);
}
Reported by PMD.
Line: 14
IllegalAccessError ex = new IllegalAccessError();
String text = JSON.toJSONString(ex);
assertTrue(JSON.parse(text) instanceof IllegalAccessError);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/MapSortFieldTest.java
2 issues
Line: 14
* Created by wenshao on 14/02/2017.
*/
public class MapSortFieldTest extends TestCase {
public void test_mapSortField() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 123);
map.put("name", "wenshao");
String json = JSON.toJSONString(map, SerializerFeature.MapSortField);
Reported by PMD.
Line: 20
map.put("name", "wenshao");
String json = JSON.toJSONString(map, SerializerFeature.MapSortField);
assertEquals("{\"id\":123,\"name\":\"wenshao\"}", json);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestBooleanField.java
2 issues
Line: 12
public class WriteNonStringValueAsStringTestBooleanField extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = true;
Assert.assertEquals("{\"id\":\"true\"}", JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString));
Assert.assertEquals("{\"id\":true}", JSON.toJSONString(vo));
Reported by PMD.
Line: 22
public static class VO {
public boolean id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestDoubleField.java
2 issues
Line: 11
import junit.framework.TestCase;
public class WriteNonStringValueAsStringTestDoubleField extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = 100;
String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
Assert.assertEquals("{\"id\":\"100.0\"}", text);
Reported by PMD.
Line: 20
}
public static class VO {
public double id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestFloatField.java
2 issues
Line: 11
import junit.framework.TestCase;
public class WriteNonStringValueAsStringTestFloatField extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = 100;
String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
Assert.assertEquals("{\"id\":\"100.0\"}", text);
Reported by PMD.
Line: 20
}
public static class VO {
public float id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestFloatField2.java
2 issues
Line: 10
import org.junit.Assert;
public class WriteNonStringValueAsStringTestFloatField2 extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = 100;
String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
Assert.assertEquals("{\"id\":\"100.00\"}", text);
Reported by PMD.
Line: 20
public static class VO {
@JSONField(format = "0.00")
public float id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestIntField.java
2 issues
Line: 11
import junit.framework.TestCase;
public class WriteNonStringValueAsStringTestIntField extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = 100;
String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
Assert.assertEquals("{\"id\":\"100\"}", text);
Reported by PMD.
Line: 20
}
public static class VO {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestLongField.java
2 issues
Line: 11
import junit.framework.TestCase;
public class WriteNonStringValueAsStringTestLongField extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.id = 100;
String text = JSON.toJSONString(vo, SerializerFeature.WriteNonStringValueAsString);
Assert.assertEquals("{\"id\":\"100\"}", text);
Reported by PMD.
Line: 20
}
public static class VO {
public long id;
}
}
Reported by PMD.