The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/JSONSerializerDeprecatedTest.java
1 issues
Line: 14
@SuppressWarnings("deprecation")
public class JSONSerializerDeprecatedTest extends TestCase {
public void test_() throws Exception {
JSONSerializer ser = new JSONSerializer(new SerializeConfig());
ser.setDateFormat(new ISO8601DateFormat());
Assert.assertEquals(null, ser.getDateFormatPattern());
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/IntegerSerializerTest.java
1 issues
Line: 12
public class IntegerSerializerTest extends TestCase {
public void test_null() throws Exception {
VO vo = new VO();
Assert.assertEquals("{\"value\":null}", JSON.toJSONString(vo, SerializerFeature.WriteMapNullValue));
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/InetSocketAddressTest.java
1 issues
Line: 13
public class InetSocketAddressTest extends TestCase {
public void test_timezone() throws Exception {
InetSocketAddress address = new InetSocketAddress(InetAddress.getLocalHost(), 80);
String text = JSON.toJSONString(address);
InetSocketAddress address2 = JSON.parseObject(text, InetSocketAddress.class);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReader_string_1.java
1 issues
Line: 12
import com.alibaba.fastjson.JSONReader;
public class JSONReader_string_1 extends TestCase {
public void test_obj() throws Exception {
JSONReader reader = new JSONReader(new StringReader("\"abc\""));
Assert.assertEquals("abc", reader.readString());
reader.close();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/IgnoreNonFieldGetterTest2.java
1 issues
Line: 12
public class IgnoreNonFieldGetterTest2 extends TestCase {
public void test_int() throws Exception {
VO vo = new VO();
vo.setId(123);
String text = JSON.toJSONString(vo, SerializerFeature.IgnoreNonFieldGetter);
Assert.assertEquals("{\"id\":123}", text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/IgnoreNonFieldGetterTest.java
1 issues
Line: 12
public class IgnoreNonFieldGetterTest extends TestCase {
public void test_int() throws Exception {
VO vo = new VO();
vo.setId(123);
String text = JSON.toJSONString(vo, SerializerFeature.IgnoreNonFieldGetter);
Assert.assertEquals("{\"id\":123}", text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/FileTest.java
1 issues
Line: 13
public class FileTest extends TestCase {
public void test_file() throws Exception {
File file = new File("abc.txt");
String text = JSON.toJSONString(file);
Assert.assertEquals(JSON.toJSONString(file.getPath()), text);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ErrorTest.java
1 issues
Line: 17
public class ErrorTest extends TestCase {
public void test_error() throws Exception {
SerializeConfig config = new SerializeConfig();
config.put(A.class, new ObjectSerializer() {
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features)
throws IOException {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DoubleTest_custom2.java
1 issues
Line: 17
public class DoubleTest_custom2 extends TestCase {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void test_0() throws Exception {
Map values = new HashMap();
Double v = 9.00;
values.put("double", v);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/DoubleArraySerializerTest.java
1 issues
Line: 11
public class DoubleArraySerializerTest extends TestCase {
public void test_0() {
Assert.assertEquals("[]", JSON.toJSONString(new double[0]));
Assert.assertEquals("[null]", JSON.toJSONString(new double[] { Double.NaN }));
Assert.assertEquals("[1.0,2.0]", JSON.toJSONString(new double[] { 1, 2 }));
Assert.assertEquals("[1.0,2.0,3.0]", JSON.toJSONString(new double[] { 1, 2, 3 }));
Assert.assertEquals("[1.0,2.0,3.0,null,null]", JSON.toJSONString(new double[] { 1, 2, 3, Double.NaN, Double.NaN }));
Reported by PMD.