The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/LocaleTest.java
4 issues
Line: 16
public class LocaleTest extends TestCase {
public void test_0() throws Exception {
String input = JSON.toJSONString(Locale.US);
Assert.assertEquals(Locale.US, JSON.parseObject(input, Locale.class));
}
public void test_1() throws Exception {
Reported by PMD.
Line: 21
Assert.assertEquals(Locale.US, JSON.parseObject(input, Locale.class));
}
public void test_1() throws Exception {
Locale l1 = new Locale("l1");
String input = JSON.toJSONString(l1);
Assert.assertEquals(l1, JSON.parseObject(input, Locale.class));
}
Reported by PMD.
Line: 27
Assert.assertEquals(l1, JSON.parseObject(input, Locale.class));
}
public void test_2() throws Exception {
Locale l1 = new Locale("l1", "l2", "l3");
String input = JSON.toJSONString(l1);
Assert.assertEquals(l1, JSON.parseObject(input, Locale.class));
}
Reported by PMD.
Line: 33
Assert.assertEquals(l1, JSON.parseObject(input, Locale.class));
}
public void test_null() throws Exception {
String input = "null";
DefaultJSONParser parser = new DefaultJSONParser(input, ParserConfig.getGlobalInstance(), JSON.DEFAULT_PARSER_FEATURE);
MiscCodec deser = new MiscCodec();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/InterfaceParseTest.java
4 issues
Line: 25
void setI(int value);
void setC(char value);
void setS(short value);
void setL(long value);
}
}
Reported by PMD.
Line: 10
public class InterfaceParseTest extends TestCase {
public void test_interface() throws Exception {
VO vo = JSON.parseObject("{\"text\":\"abc\",\"b\":true}", VO.class);
Assert.assertEquals("abc", vo.getText());
Assert.assertEquals(Boolean.TRUE, vo.getB());
}
Reported by PMD.
Line: 12
public class InterfaceParseTest extends TestCase {
public void test_interface() throws Exception {
VO vo = JSON.parseObject("{\"text\":\"abc\",\"b\":true}", VO.class);
Assert.assertEquals("abc", vo.getText());
Assert.assertEquals(Boolean.TRUE, vo.getB());
}
public static interface VO {
void setText(String val);
Reported by PMD.
Line: 13
public void test_interface() throws Exception {
VO vo = JSON.parseObject("{\"text\":\"abc\",\"b\":true}", VO.class);
Assert.assertEquals("abc", vo.getText());
Assert.assertEquals(Boolean.TRUE, vo.getB());
}
public static interface VO {
void setText(String val);
String getText();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/PropertyFilterClassLevelTest.java
4 issues
Line: 13
public class PropertyFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/PropertyFilterClassLevelTest_private.java
4 issues
Line: 13
public class PropertyFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
Line: 14
public class PropertyFilterClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new PropertyFilter() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/ValueClassLevelTest.java
4 issues
Line: 13
public class ValueClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/ValueClassLevelTest_private.java
4 issues
Line: 13
public class ValueClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
Line: 14
public class ValueClassLevelTest_private extends TestCase {
public void test_0() throws Exception {
Object[] array = { new ModelA(), new ModelB() };
SerializeConfig config = new SerializeConfig();
config.addFilter(ModelA.class, //
new ValueFilter() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/prettyFormat/ArrayListFieldTest.java
4 issues
Line: 21
String text = JSON.toJSONString(vo, SerializerFeature.PrettyFormat, SerializerFeature.UseSingleQuotes);
System.out.println(text);
}
public static class VO {
private final List<Entity> entries = new ArrayList<Entity>();
Reported by PMD.
Line: 13
public class ArrayListFieldTest extends TestCase {
public void test_prettyFormat() throws Exception {
VO vo = new VO();
vo.getEntries().add(new Entity(123, "aaa"));
vo.getEntries().add(new Entity(234, "bbb"));
vo.getEntries().add(new Entity(3, "ccc"));
Reported by PMD.
Line: 13
public class ArrayListFieldTest extends TestCase {
public void test_prettyFormat() throws Exception {
VO vo = new VO();
vo.getEntries().add(new Entity(123, "aaa"));
vo.getEntries().add(new Entity(234, "bbb"));
vo.getEntries().add(new Entity(3, "ccc"));
Reported by PMD.
Line: 34
}
public static class Entity {
private int id;
private String name;
public Entity(){
Reported by PMD.
src/test/java/com/alibaba/json/bvt/support/hsf/HSFJSONUtilsTest_2.java
4 issues
Line: 11
import java.lang.reflect.Method;
public class HSFJSONUtilsTest_2 extends TestCase {
public void test_for_hsf() throws Exception {
final Method method = HSFJSONUtilsTest_2.class.getMethod("f", VeryComplexDO.class);
String json = "{\n" +
"\t\"argsTypes\":[\"com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_2.VeryComplexDO\"],\n" +
"\t\"argsObjs\":[\n" +
Reported by PMD.
Line: 11
import java.lang.reflect.Method;
public class HSFJSONUtilsTest_2 extends TestCase {
public void test_for_hsf() throws Exception {
final Method method = HSFJSONUtilsTest_2.class.getMethod("f", VeryComplexDO.class);
String json = "{\n" +
"\t\"argsTypes\":[\"com.alibaba.json.bvt.support.hsf.HSFJSONUtilsTest_2.VeryComplexDO\"],\n" +
"\t\"argsObjs\":[\n" +
Reported by PMD.
Line: 6
import com.alibaba.fastjson.support.hsf.HSFJSONUtils;
import com.alibaba.fastjson.support.hsf.MethodLocator;
import junit.framework.TestCase;
import net.minidev.json.JSONUtil;
import java.lang.reflect.Method;
public class HSFJSONUtilsTest_2 extends TestCase {
public void test_for_hsf() throws Exception {
Reported by PMD.
Line: 35
HSFJSONUtils.parseInvocationArguments(json, new MethodLocator() {
public Method findMethod(String[] types) {
return method;
}
});
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/util/IOUtilsTest.java
4 issues
Line: 9
import java.io.StringReader;
public class IOUtilsTest extends TestCase {
public void test_readAll() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1024 * 64; ++i) {
buf.append("a");
}
Reported by PMD.
Line: 9
import java.io.StringReader;
public class IOUtilsTest extends TestCase {
public void test_readAll() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1024 * 64; ++i) {
buf.append("a");
}
Reported by PMD.
Line: 12
public void test_readAll() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 1024 * 64; ++i) {
buf.append("a");
}
StringReader reader = new StringReader(buf.toString());
IOUtils.readAll(reader);
}
Reported by PMD.
Line: 15
buf.append("a");
}
StringReader reader = new StringReader(buf.toString());
IOUtils.readAll(reader);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/util/GenericFieldInfoTest2.java
4 issues
Line: 13
* Created by wenshao on 30/05/2017.
*/
public class GenericFieldInfoTest2 extends TestCase {
public void test_generic() throws Exception {
A4 a = JSON.parseObject("{\"data\":[]3}", A4.class);
assertTrue(a.data instanceof List);
}
Reported by PMD.
Line: 15
public class GenericFieldInfoTest2 extends TestCase {
public void test_generic() throws Exception {
A4 a = JSON.parseObject("{\"data\":[]3}", A4.class);
assertTrue(a.data instanceof List);
}
public static class A <T> {
public T data;
Reported by PMD.
Line: 20
public static class A <T> {
public T data;
}
public static class A1 <T> extends A<T> {
}
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import junit.framework.TestCase;
import java.util.List;
/**
Reported by PMD.