The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_float.java
3 issues
Line: 11
import junit.framework.TestCase;
public class ArrayMapping_float extends TestCase {
public void test_float() throws Exception {
Model model = JSON.parseObject("[123.45,\"wenshao\"]", Model.class, Feature.SupportArrayToBean);
Assert.assertTrue(123.45F == model.id);
Assert.assertEquals("wenshao", model.name);
}
Reported by PMD.
Line: 18
}
public static class Model {
public float id;
public String name;
}
}
Reported by PMD.
Line: 19
public static class Model {
public float id;
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/features/WriteNonStringValueAsStringTestShortField.java
3 issues
Line: 20
}
public static class VO {
public short id;
}
}
Reported by PMD.
Line: 11
import junit.framework.TestCase;
public class WriteNonStringValueAsStringTestShortField 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 short id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeConfigTest2.java
3 issues
Line: 15
public class SerializeConfigTest2 extends TestCase {
public void test_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.setTypeKey("%type");
Assert.assertEquals("%type", config.getTypeKey());
Model model = new Model();
Reported by PMD.
Line: 28
}
public static class Model {
public int value;
}
}
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.serializer;
import java.util.LinkedHashMap;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeConfigTest2_private.java
3 issues
Line: 15
public class SerializeConfigTest2_private extends TestCase {
public void test_1() throws Exception {
SerializeConfig config = new SerializeConfig();
config.setTypeKey("%type");
Assert.assertEquals("%type", config.getTypeKey());
Model model = new Model();
Reported by PMD.
Line: 28
}
private static class Model {
public int value;
}
}
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.serializer;
import java.util.LinkedHashMap;
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/TreeMapDeserializerTest.java
3 issues
Line: 11
import com.alibaba.fastjson.JSON;
public class TreeMapDeserializerTest extends TestCase {
public void test_0 () throws Exception {
TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
Assert.assertEquals(0, treeMap.size());
}
}
Reported by PMD.
Line: 12
public class TreeMapDeserializerTest extends TestCase {
public void test_0 () throws Exception {
TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
Assert.assertEquals(0, treeMap.size());
}
}
Reported by PMD.
Line: 13
public class TreeMapDeserializerTest extends TestCase {
public void test_0 () throws Exception {
TreeMap treeMap = JSON.parseObject("{}", TreeMap.class);
Assert.assertEquals(0, treeMap.size());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_long.java
3 issues
Line: 11
import junit.framework.TestCase;
public class ArrayMapping_long extends TestCase {
public void test_for_error() throws Exception {
Model model = JSON.parseObject("[1001,\"wenshao\"]", Model.class, Feature.SupportArrayToBean);
Assert.assertEquals(1001, model.id);
Assert.assertEquals("wenshao", model.name);
}
Reported by PMD.
Line: 18
}
public static class Model {
public long id;
public String name;
}
}
Reported by PMD.
Line: 19
public static class Model {
public long id;
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/TimeZoneDeserializerTest.java
3 issues
Line: 14
import junit.framework.TestCase;
public class TimeZoneDeserializerTest extends TestCase {
public void test_timezone() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
}
}
Reported by PMD.
Line: 16
public class TimeZoneDeserializerTest extends TestCase {
public void test_timezone() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
}
}
Reported by PMD.
Line: 17
public void test_timezone() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("null", ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
Assert.assertEquals(null, MiscCodec.instance.deserialze(parser, null, null));
Assert.assertEquals(JSONToken.LITERAL_STRING, MiscCodec.instance.getFastMatchToken());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/arraymapping/ArrayMapping_long_stream.java
3 issues
Line: 13
import junit.framework.TestCase;
public class ArrayMapping_long_stream extends TestCase {
public void test_for_error() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[1001,\"wenshao\"]"), Feature.SupportArrayToBean);
Model model = reader.readObject(Model.class);
Assert.assertEquals(1001, model.id);
Assert.assertEquals("wenshao", model.name);
Reported by PMD.
Line: 22
}
public static class Model {
public long id;
public String name;
}
}
Reported by PMD.
Line: 23
public static class Model {
public long id;
public String name;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SerializeWriterTest_12.java
3 issues
Line: 14
public class SerializeWriterTest_12 extends TestCase {
public void test_erro_0() throws Exception {
SerializeWriter out = new SerializeWriter(new ErrorWriter());
Exception error = null;
try {
out.flush();
} catch (Exception ex) {
Reported by PMD.
Line: 19
Exception error = null;
try {
out.flush();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
out.close();
}
Reported by PMD.
Line: 16
public void test_erro_0() throws Exception {
SerializeWriter out = new SerializeWriter(new ErrorWriter());
Exception error = null;
try {
out.flush();
} catch (Exception ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/stream/JSONReader_string.java
3 issues
Line: 13
public class JSONReader_string extends TestCase {
public void test_array() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[\"abc\"]"));
reader.startArray();
Assert.assertEquals("abc", reader.readString());
Reported by PMD.
Line: 25
reader.close();
}
public void test_array_2() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[[\"abc\"]]"));
reader.startArray();
reader.startArray();
Reported by PMD.
Line: 39
reader.close();
}
public void test_array_3() throws Exception {
JSONReader reader = new JSONReader(new StringReader("[[[\"abc\"]]]"));
reader.startArray();
reader.startArray();
reader.startArray();
Reported by PMD.