The following issues were found
src/test/java/com/alibaba/json/bvt/issue_3300/Issue3329.java
11 issues
Line: 14
import java.lang.reflect.Type;
public class Issue3329 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
Reported by PMD.
Line: 14
import java.lang.reflect.Type;
public class Issue3329 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
Reported by PMD.
Line: 17
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
Reported by PMD.
Line: 19
IdentityHashMap<Type, ObjectDeserializer> deserializers = config.getDeserializers();
int initSize = deserializers.size();
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
Reported by PMD.
Line: 21
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
}
Reported by PMD.
Line: 21
for (int i = 0; i < 1000 * 10; ++i) {
assertEquals(123,
((VO<User>) JSON.parseObject("{\"value\":{\"id\":123}}",
new ParameterizedTypeImpl(new Type[] {User.class}, null, VO.class),
config
)).value.id
);
}
Reported by PMD.
Line: 28
}
assertEquals(2, deserializers.size() - initSize);
}
public static class VO<T> {
public T value;
}
Reported by PMD.
Line: 28
}
assertEquals(2, deserializers.size() - initSize);
}
public static class VO<T> {
public T value;
}
Reported by PMD.
Line: 32
}
public static class VO<T> {
public T value;
}
public static class User {
public int id;
}
Reported by PMD.
Line: 36
}
public static class User {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1500/Issue1582.java
11 issues
Line: 9
import junit.framework.TestCase;
public class Issue1582 extends TestCase {
public void test_for_issue() throws Exception {
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Issue1582 extends TestCase {
public void test_for_issue() throws Exception {
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
Reported by PMD.
Line: 10
public class Issue1582 extends TestCase {
public void test_for_issue() throws Exception {
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
Reported by PMD.
Line: 11
public class Issue1582 extends TestCase {
public void test_for_issue() throws Exception {
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
}
Reported by PMD.
Line: 12
public void test_for_issue() throws Exception {
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
}
Reported by PMD.
Line: 13
assertSame(Size.Big, JSON.parseObject("\"Big\"", Size.class));
assertSame(Size.Big, JSON.parseObject("\"big\"", Size.class));
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
}
public void test_for_issue_1() throws Exception {
Reported by PMD.
Line: 15
assertNull(JSON.parseObject("\"Large\"", Size.class));
assertSame(Size.LL, JSON.parseObject("\"L3\"", Size.class));
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
}
public void test_for_issue_1() throws Exception {
JSONObject object = JSON.parseObject("{\"size\":\"Little\"}");
Model model = object.toJavaObject(Model.class);
Reported by PMD.
Line: 18
assertSame(Size.Small, JSON.parseObject("\"Little\"", Size.class));
}
public void test_for_issue_1() throws Exception {
JSONObject object = JSON.parseObject("{\"size\":\"Little\"}");
Model model = object.toJavaObject(Model.class);
assertSame(Size.Small, model.size);
}
Reported by PMD.
Line: 20
public void test_for_issue_1() throws Exception {
JSONObject object = JSON.parseObject("{\"size\":\"Little\"}");
Model model = object.toJavaObject(Model.class);
assertSame(Size.Small, model.size);
}
public static class Model {
public Size size;
Reported by PMD.
Line: 21
public void test_for_issue_1() throws Exception {
JSONObject object = JSON.parseObject("{\"size\":\"Little\"}");
Model model = object.toJavaObject(Model.class);
assertSame(Size.Small, model.size);
}
public static class Model {
public Size size;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2900/Issue2914.java
11 issues
Line: 12
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2914 extends TestCase {
public void test_for_issue() throws Exception {
ComplexInt complexInt = new ComplexInt();
Queue<Integer> blockQueueInt = new ArrayBlockingQueue<Integer>(5);
blockQueueInt.offer(1);
Reported by PMD.
Line: 12
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2914 extends TestCase {
public void test_for_issue() throws Exception {
ComplexInt complexInt = new ComplexInt();
Queue<Integer> blockQueueInt = new ArrayBlockingQueue<Integer>(5);
blockQueueInt.offer(1);
Reported by PMD.
Line: 24
String jsonInt = JSON.toJSONString(complexInt);
assertEquals("{\"blockQueue\":[1,2,3]}",jsonInt);
ComplexInt complexInt1 = JSON.parseObject(jsonInt,Issue2914.ComplexInt.class);
assertEquals(3, complexInt1.getBlockQueue().size());
Reported by PMD.
Line: 28
ComplexInt complexInt1 = JSON.parseObject(jsonInt,Issue2914.ComplexInt.class);
assertEquals(3, complexInt1.getBlockQueue().size());
Complex complex = new Complex();
Queue<String> blockQueue = new ArrayBlockingQueue<String>(5);
Reported by PMD.
Line: 28
ComplexInt complexInt1 = JSON.parseObject(jsonInt,Issue2914.ComplexInt.class);
assertEquals(3, complexInt1.getBlockQueue().size());
Complex complex = new Complex();
Queue<String> blockQueue = new ArrayBlockingQueue<String>(5);
Reported by PMD.
Line: 28
ComplexInt complexInt1 = JSON.parseObject(jsonInt,Issue2914.ComplexInt.class);
assertEquals(3, complexInt1.getBlockQueue().size());
Complex complex = new Complex();
Queue<String> blockQueue = new ArrayBlockingQueue<String>(5);
Reported by PMD.
Line: 41
String json = JSON.toJSONString(complex);
assertEquals("{\"blockQueue\":[\"BlockQueue 1\",\"BlockQueue 2\",\"BlockQueue 3\"]}",json);
Complex complex1 = JSON.parseObject(json,Issue2914.Complex.class);
assertEquals(3, complex1.getBlockQueue().size());
Reported by PMD.
Line: 45
Complex complex1 = JSON.parseObject(json,Issue2914.Complex.class);
assertEquals(3, complex1.getBlockQueue().size());
}
Reported by PMD.
Line: 45
Complex complex1 = JSON.parseObject(json,Issue2914.Complex.class);
assertEquals(3, complex1.getBlockQueue().size());
}
Reported by PMD.
Line: 45
Complex complex1 = JSON.parseObject(json,Issue2914.Complex.class);
assertEquals(3, complex1.getBlockQueue().size());
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2900/Issue2939.java
11 issues
Line: 13
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2939 extends TestCase {
public void test_for_issue() throws Exception {
LinkedMultiValueMap multiValueMap = new LinkedMultiValueMap();
multiValueMap.add("k1","k11");
multiValueMap.add("k1","k12");
multiValueMap.add("k1","k13");
Reported by PMD.
Line: 13
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2939 extends TestCase {
public void test_for_issue() throws Exception {
LinkedMultiValueMap multiValueMap = new LinkedMultiValueMap();
multiValueMap.add("k1","k11");
multiValueMap.add("k1","k12");
multiValueMap.add("k1","k13");
Reported by PMD.
Line: 23
String json = JSON.toJSONString(multiValueMap);
assertEquals("{\"k1\":[\"k11\",\"k12\",\"k13\"],\"k2\":[\"k21\"]}", json);
Object obj = JSON.parseObject(json, LinkedMultiValueMap.class);
assertTrue(obj != null);
Reported by PMD.
Line: 27
Object obj = JSON.parseObject(json, LinkedMultiValueMap.class);
assertTrue(obj != null);
LinkedMultiValueMap map = (LinkedMultiValueMap) obj;
assertSame(3, map.get("k1").size());
}
Reported by PMD.
Line: 27
Object obj = JSON.parseObject(json, LinkedMultiValueMap.class);
assertTrue(obj != null);
LinkedMultiValueMap map = (LinkedMultiValueMap) obj;
assertSame(3, map.get("k1").size());
}
Reported by PMD.
Line: 30
assertTrue(obj != null);
LinkedMultiValueMap map = (LinkedMultiValueMap) obj;
assertSame(3, map.get("k1").size());
}
}
Reported by PMD.
Line: 30
assertTrue(obj != null);
LinkedMultiValueMap map = (LinkedMultiValueMap) obj;
assertSame(3, map.get("k1").size());
}
}
Reported by PMD.
Line: 30
assertTrue(obj != null);
LinkedMultiValueMap map = (LinkedMultiValueMap) obj;
assertSame(3, map.get("k1").size());
}
}
Reported by PMD.
Line: 7
import junit.framework.TestCase;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2939 extends TestCase {
Reported by PMD.
Line: 9
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
public class Issue2939 extends TestCase {
public void test_for_issue() throws Exception {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/date/DateFieldTest3.java
11 issues
Line: 17
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
public class DateFieldTest3 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_codec() throws Exception {
Reported by PMD.
Line: 22
JSON.defaultLocale = Locale.CHINA;
}
public void test_codec() throws Exception {
SerializeConfig mapping = new SerializeConfig();
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
V0 v = new V0();
v.setValue(new Date());
Reported by PMD.
Line: 24
public void test_codec() throws Exception {
SerializeConfig mapping = new SerializeConfig();
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
V0 v = new V0();
v.setValue(new Date());
String text = JSON.toJSONString(v, mapping);
Reported by PMD.
Line: 36
Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
public void test_codec_no_asm() throws Exception {
V0 v = new V0();
v.setValue(new Date());
SerializeConfig mapping = new SerializeConfig();
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
Reported by PMD.
Line: 50
Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
public void test_codec_asm() throws Exception {
V0 v = new V0();
v.setValue(new Date());
SerializeConfig mapping = new SerializeConfig();
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
Reported by PMD.
Line: 64
Assert.assertEquals("{\"value\":" + JSON.toJSONString(format.format(v.getValue())) + "}", text);
}
public void test_codec_null_asm() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(true);
Reported by PMD.
Line: 76
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_no_asm() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 79
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_no_asm() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
mapping.setAsmEnable(false);
Reported by PMD.
Line: 91
V0 v1 = JSON.parseObject(text, V0.class);
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
Reported by PMD.
Line: 94
Assert.assertEquals(v1.getValue(), v.getValue());
}
public void test_codec_null_1() throws Exception {
V0 v = new V0();
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1700/Issue1763.java
11 issues
Line: 12
import java.util.Map;
public class Issue1763 extends TestCase {
public void test_for_issue() throws Exception {
String s = "{\"result\":{\"modelList\":[{\"sourceId\":\"81900002\"},{\"sourceId\":\"81900002\"},{\"sourceId\":\"81892012\"},{\"sourceId\":\"2062014\"},{\"sourceId\":\"2082007\"},{\"sourceId\":\"2082007\"},{\"sourceId\":\"2082007\"}]}}";
Method method = ProcurementOrderInteractiveServiceForCloud.class.getMethod("queryOrderMateriel", Map.class);
Type type = method.getGenericReturnType();
Reported by PMD.
Line: 12
import java.util.Map;
public class Issue1763 extends TestCase {
public void test_for_issue() throws Exception {
String s = "{\"result\":{\"modelList\":[{\"sourceId\":\"81900002\"},{\"sourceId\":\"81900002\"},{\"sourceId\":\"81892012\"},{\"sourceId\":\"2062014\"},{\"sourceId\":\"2082007\"},{\"sourceId\":\"2082007\"},{\"sourceId\":\"2082007\"}]}}";
Method method = ProcurementOrderInteractiveServiceForCloud.class.getMethod("queryOrderMateriel", Map.class);
Type type = method.getGenericReturnType();
Reported by PMD.
Line: 17
Method method = ProcurementOrderInteractiveServiceForCloud.class.getMethod("queryOrderMateriel", Map.class);
Type type = method.getGenericReturnType();
BaseResult<InteractiveOrderMaterielQueryResult> baseResult = JSON.parseObject(s, type);
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
Reported by PMD.
Line: 20
Type type = method.getGenericReturnType();
BaseResult<InteractiveOrderMaterielQueryResult> baseResult = JSON.parseObject(s, type);
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
Reported by PMD.
Line: 22
BaseResult<InteractiveOrderMaterielQueryResult> baseResult = JSON.parseObject(s, type);
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
Line: 22
BaseResult<InteractiveOrderMaterielQueryResult> baseResult = JSON.parseObject(s, type);
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
Line: 22
BaseResult<InteractiveOrderMaterielQueryResult> baseResult = JSON.parseObject(s, type);
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
Line: 23
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
Line: 23
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
Line: 23
InteractiveOrderMaterielQueryResult result = baseResult.getResult();
assertEquals(7, result.getModelList().size());
assertEquals(InteractiveOrderMaterielModel.class, result.getModelList().get(0).getClass());
}
public static class BaseResult<T> {
private T result;
Reported by PMD.
src/test/java/com/alibaba/json/test/Issue1488.java
11 issues
Line: 23
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
for (int i = 0; i < 10; ++i) {
System.out.println("start....");
threadPool.scheduleAtFixedRate(new Runnable() {
public void run() {
Map map = new HashMap();
map.put("run_id", "aeca30e");
map.put("port", 1002);
Reported by PMD.
Line: 30
map.put("run_id", "aeca30e");
map.put("port", 1002);
map.put("processId", 3001);
System.out.println(JSON.toJSONString(JSON.parseObject(JSON.toJSONString(map), clazz)));
}
}, 1, 1, TimeUnit.SECONDS);
}
Thread.sleep(1000 * 1000);
Reported by PMD.
Line: 16
import java.util.concurrent.TimeUnit;
public class Issue1488 extends TestCase {
public void test_user() throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
final Class clazz = classLoader.loadClass("Issue1488_Server");
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
Reported by PMD.
Line: 16
import java.util.concurrent.TimeUnit;
public class Issue1488 extends TestCase {
public void test_user() throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
final Class clazz = classLoader.loadClass("Issue1488_Server");
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
Reported by PMD.
Line: 24
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
for (int i = 0; i < 10; ++i) {
System.out.println("start....");
threadPool.scheduleAtFixedRate(new Runnable() {
public void run() {
Map map = new HashMap();
map.put("run_id", "aeca30e");
map.put("port", 1002);
map.put("processId", 3001);
Reported by PMD.
Line: 26
System.out.println("start....");
threadPool.scheduleAtFixedRate(new Runnable() {
public void run() {
Map map = new HashMap();
map.put("run_id", "aeca30e");
map.put("port", 1002);
map.put("processId", 3001);
System.out.println(JSON.toJSONString(JSON.parseObject(JSON.toJSONString(map), clazz)));
}
Reported by PMD.
Line: 49
{
byte[] bytes;
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("kotlin/Issue1488_Server.clazz");
bytes = IOUtils.toByteArray(is);
is.close();
super.defineClass("Issue1488_Server", bytes, 0, bytes.length);
}
Reported by PMD.
Line: 18
public class Issue1488 extends TestCase {
public void test_user() throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
final Class clazz = classLoader.loadClass("Issue1488_Server");
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
for (int i = 0; i < 10; ++i) {
System.out.println("start....");
Reported by PMD.
Line: 18
public class Issue1488 extends TestCase {
public void test_user() throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
final Class clazz = classLoader.loadClass("Issue1488_Server");
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
for (int i = 0; i < 10; ++i) {
System.out.println("start....");
Reported by PMD.
Line: 21
final Class clazz = classLoader.loadClass("Issue1488_Server");
final int THREAD_NUMBER = 10;
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(THREAD_NUMBER);
for (int i = 0; i < 10; ++i) {
System.out.println("start....");
threadPool.scheduleAtFixedRate(new Runnable() {
public void run() {
Map map = new HashMap();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue169.java
11 issues
Line: 36
;
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
Reported by PMD.
Line: 15
public class Issue169 extends TestCase {
public void test_for_issue() throws Exception {
StringWriter strWriter = new StringWriter();
SectionRequest req = new SectionRequest();
req.setScreenHeight(100);// 父类中的属性
req.setScreenWidth(12);// 父类中的属性
Reported by PMD.
Line: 30
String text = strWriter.toString();
StringReader strReader = new StringReader(text);
JSONReader reader = new JSONReader(strReader);
reader.startArray();
;
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
Reported by PMD.
Line: 33
StringReader strReader = new StringReader(text);
JSONReader reader = new JSONReader(strReader);
reader.startArray();
;
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Reported by PMD.
Line: 36
;
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
Reported by PMD.
Line: 36
;
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
Reported by PMD.
Line: 37
while (reader.hasNext()) {
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
}
Reported by PMD.
Line: 38
SectionRequest vo = reader.readObject(SectionRequest.class);
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
}
reader.endArray();
Reported by PMD.
Line: 39
System.out.println("tag:" + vo.getTag() + "screenHeight:" + vo.getScreenHeight() + "ScreenWidth:"
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
}
reader.endArray();
reader.close();
Reported by PMD.
Line: 40
+ vo.getScreenWidth());
Assert.assertEquals(100, vo.getScreenHeight());
Assert.assertEquals(12, vo.getScreenWidth());
Assert.assertEquals("11", vo.getTag());
}
reader.endArray();
reader.close();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1500/Issue1500.java
11 issues
Line: 16
public class Issue1500 extends TestCase {
public void test_for_issue() throws Exception {
// test aa
Aa aa = new Aa();
aa.setName("aa");
String jsonAa = JSON.toJSONString(aa);
Reported by PMD.
Line: 23
aa.setName("aa");
String jsonAa = JSON.toJSONString(aa);
Aa aa1 = JSON.parseObject(jsonAa, Aa.class);
Assert.assertEquals("aa",aa1.getName());
// test C
C c = new C();
c.setE(aa);
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 30
c.setE(aa);
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
C c2 = JSON.parseObject(jsonC, C.class);
Assert.assertEquals("Aa",c2.getE().getClass().getSimpleName());
Assert.assertEquals("aa",((Aa)c2.getE()).getName());
}
public static class Aa extends Exception {
Reported by PMD.
Line: 30
c.setE(aa);
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
C c2 = JSON.parseObject(jsonC, C.class);
Assert.assertEquals("Aa",c2.getE().getClass().getSimpleName());
Assert.assertEquals("aa",((Aa)c2.getE()).getName());
}
public static class Aa extends Exception {
Reported by PMD.
Line: 30
c.setE(aa);
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
C c2 = JSON.parseObject(jsonC, C.class);
Assert.assertEquals("Aa",c2.getE().getClass().getSimpleName());
Assert.assertEquals("aa",((Aa)c2.getE()).getName());
}
public static class Aa extends Exception {
Reported by PMD.
Line: 31
String jsonC = JSON.toJSONString(c, SerializerFeature.WriteClassName);
C c2 = JSON.parseObject(jsonC, C.class);
Assert.assertEquals("Aa",c2.getE().getClass().getSimpleName());
Assert.assertEquals("aa",((Aa)c2.getE()).getName());
}
public static class Aa extends Exception {
public Aa(){
Reported by PMD.
Line: 34
Assert.assertEquals("aa",((Aa)c2.getE()).getName());
}
public static class Aa extends Exception {
public Aa(){
}
private String name;
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.issue_1500;
import clojure.lang.Obj;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import org.junit.Assert;
Reported by PMD.
Line: 5
import clojure.lang.Obj;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
import org.junit.Assert;
import java.util.HashMap;
Reported by PMD.
Line: 10
import junit.framework.TestCase;
import org.junit.Assert;
import java.util.HashMap;
import java.util.Map;
public class Issue1500 extends TestCase {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/mixins/MixinJSONTypeTest.java
11 issues
Line: 13
import junit.framework.TestCase;
public class MixinJSONTypeTest extends TestCase {
public void test_1() {
User user1 = new User("zhangsan", "male", 19);
Assert.assertEquals("{\"age\":19,\"sex\":\"male\",\"userName\":\"zhangsan\"}", JSON.toJSONString(user1));
JSON.addMixInAnnotations(user1.getClass(), Mixin.class);
Assert.assertEquals("{\"age\":19,\"userName\":\"zhangsan\",\"sex\":\"male\"}", JSON.toJSONString(user1));
Reported by PMD.
Line: 23
JSON.removeMixInAnnotations(user1.getClass());
}
public void test_2() {
User user1 = new User("lisi", "male", 20);
Assert.assertEquals("{\"age\":20,\"sex\":\"male\",\"userName\":\"lisi\"}", JSON.toJSONString(user1));
JSON.addMixInAnnotations(user1.getClass(), Mixin2.class);
Assert.assertEquals("{\"userName\":\"lisi\"}", JSON.toJSONString(user1));
Reported by PMD.
Line: 33
JSON.removeMixInAnnotations(user1.getClass());
}
public void test_3() {
User user1 = new User("wangwu", "male", 31);
Assert.assertEquals("{\"age\":31,\"sex\":\"male\",\"userName\":\"wangwu\"}", JSON.toJSONString(user1));
JSON.addMixInAnnotations(user1.getClass(), Mixin3.class);
Assert.assertEquals("{\"age\":31,\"sex\":\"male\"}", JSON.toJSONString(user1));
Reported by PMD.
Line: 43
JSON.removeMixInAnnotations(user1.getClass());
}
public void test_4() throws Exception {
JSON.addMixInAnnotations(VO.class, Mixin5.class);
JSON.addMixInAnnotations(VOBuilder.class, Mixin6.class);
VO vo = JSON.parseObject("{\"id\":12304,\"name\":\"ljw\"}", VO.class);
Reported by PMD.
Line: 49
VO vo = JSON.parseObject("{\"id\":12304,\"name\":\"ljw\"}", VO.class);
Assert.assertEquals(12304, vo.getId());
Assert.assertEquals("ljw", vo.getName());
JSON.removeMixInAnnotations(VO.class);
JSON.removeMixInAnnotations(VOBuilder.class);
}
Reported by PMD.
Line: 50
VO vo = JSON.parseObject("{\"id\":12304,\"name\":\"ljw\"}", VO.class);
Assert.assertEquals(12304, vo.getId());
Assert.assertEquals("ljw", vo.getName());
JSON.removeMixInAnnotations(VO.class);
JSON.removeMixInAnnotations(VOBuilder.class);
}
Reported by PMD.
Line: 57
}
@JSONType(serialzeFeatures = { SerializerFeature.QuoteFieldNames })
public class User {
private String userName;
private String sex;
private int age;
public User(String userName, String sex, int age) {
Reported by PMD.
Line: 111
}
public static class VO {
private int id;
private String name;
public int getId() {
return id;
}
Reported by PMD.
Line: 112
public static class VO {
private int id;
private String name;
public int getId() {
return id;
}
Reported by PMD.
Line: 125
private static class VOBuilder {
private VO vo = new VO();
public VO xxx() {
return vo;
}
Reported by PMD.