The following issues were found
src/test/java/com/alibaba/json/bvt/IntegerArrayFieldTest.java
11 issues
Line: 12
public class IntegerArrayFieldTest extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(new Integer[] { Integer.valueOf(1), Integer.valueOf(2) });
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 22
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue()[0], user.getValue()[0]);
Assert.assertEquals(user1.getValue()[1], user.getValue()[1]);
}
public void test_codec_null() throws Exception {
User user = new User();
Reported by PMD.
Line: 23
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue()[0], user.getValue()[0]);
Assert.assertEquals(user1.getValue()[1], user.getValue()[1]);
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 26
Assert.assertEquals(user1.getValue()[1], user.getValue()[1]);
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 36
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null_1() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 39
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_null_1() throws Exception {
User user = new User();
user.setValue(null);
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 49
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(0, user1.getValue().length);
}
public static class User {
private Integer[] value;
Reported by PMD.
Line: 49
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(0, user1.getValue().length);
}
public static class User {
private Integer[] value;
Reported by PMD.
Line: 57
private Integer[] value;
public Integer[] getValue() {
return value;
}
public void setValue(Integer[] value) {
this.value = value;
}
Reported by PMD.
Line: 60
return value;
}
public void setValue(Integer[] value) {
this.value = value;
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/ref/RefTest7.java
11 issues
Line: 21
VO[] root = new VO[] { vo };
String text = JSON.toJSONString(root);
System.out.println(text);
VO[] array2 = JSON.parseObject(text, VO[].class);
Assert.assertEquals(1, array2.length);
Assert.assertNotNull(array2[0].getA());
Assert.assertNotNull(array2[0].getB());
Reported by PMD.
Line: 11
public class RefTest7 extends TestCase {
public void test_bug_for_juqkai() throws Exception {
VO vo = new VO();
C c = new C();
vo.setA(new A(c));
vo.setB(new B(c));
Reported by PMD.
Line: 27
Assert.assertEquals(1, array2.length);
Assert.assertNotNull(array2[0].getA());
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
Reported by PMD.
Line: 27
Assert.assertEquals(1, array2.length);
Assert.assertNotNull(array2[0].getA());
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
Reported by PMD.
Line: 28
Assert.assertNotNull(array2[0].getA());
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
Reported by PMD.
Line: 28
Assert.assertNotNull(array2[0].getA());
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
Reported by PMD.
Line: 29
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
private A a;
Reported by PMD.
Line: 29
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
private A a;
Reported by PMD.
Line: 29
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
private A a;
Reported by PMD.
Line: 29
Assert.assertNotNull(array2[0].getB());
Assert.assertNotNull(array2[0].getA().getC());
Assert.assertNotNull(array2[0].getB().getC());
Assert.assertSame(array2[0].getA().getC(), array2[0].getB().getC());
}
public static class VO {
private A a;
Reported by PMD.
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/parser/JSONLexerTest_2.java
11 issues
Line: 15
public class JSONLexerTest_2 extends TestCase {
public void test_0() throws Exception {
VO vo = (VO) JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}", VO.class);
Assert.assertNotNull(vo);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 20
Assert.assertNotNull(vo);
}
public void test_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO1\"}", VO.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 30
Assert.assertNotNull(error);
}
public void test_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$A\"}", VO.class);
} catch (JSONException ex) {
error = ex;
Reported by PMD.
Line: 40
Assert.assertNotNull(error);
}
public void test_a() throws Exception {
P a = JSON.parseObject("{\"vo\":{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}}", P.class);
Assert.assertNotNull(a);
}
public void test_list() throws Exception {
Reported by PMD.
Line: 45
Assert.assertNotNull(a);
}
public void test_list() throws Exception {
List<VO> list = JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}]",
new TypeReference<List<VO>>() {
});
Assert.assertNotNull(list);
Assert.assertNotNull(list.get(0));
Reported by PMD.
Line: 53
Assert.assertNotNull(list.get(0));
}
public void test_list_2() throws Exception {
List<VO> list = JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"},{}]",
new TypeReference<List<VO>>() {
});
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
Reported by PMD.
Line: 63
Assert.assertNotNull(list.get(1));
}
public void test_error() throws Exception {
Exception error = null;
try {
JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}[]",
new TypeReference<List<VO>>() {
});
Reported by PMD.
Line: 69
JSON.parseObject("[{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO\"}[]",
new TypeReference<List<VO>>() {
});
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
Reported by PMD.
Line: 21
}
public void test_1() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$VO1\"}", VO.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
Line: 31
}
public void test_2() throws Exception {
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.parser.JSONLexerTest_2$A\"}", VO.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_331.java
11 issues
Line: 37
String json = JSON.toJSONString(original, SerializerFeature.UseISO8601DateFormat);
System.out.println(json); //V1.2.4 输出{"calendar":"2015-05-23","date":"2015-05-23"} , V1.2.6 输出{"calendar":"2015-05-23+08:00","date":"2015-05-23+08:00"}
Model actual = JSON.parseObject(json, Model.class);
Assert.assertNotNull(actual);
Assert.assertNotNull(actual.getDate());
Reported by PMD.
Line: 17
import junit.framework.TestCase;
public class Bug_for_issue_331 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_issue() throws Exception {
Reported by PMD.
Line: 22
JSON.defaultLocale = Locale.CHINA;
}
public void test_for_issue() throws Exception {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
format.setTimeZone(JSON.defaultTimeZone);
Date date = format.parse("2015-05-23");
Reported by PMD.
Line: 29
Date date = format.parse("2015-05-23");
Calendar c = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);
c.setTime(date);
Model original = new Model();
original.setDate(date);
original.setCalendar(c);
Reported by PMD.
Line: 42
Model actual = JSON.parseObject(json, Model.class);
Assert.assertNotNull(actual);
Assert.assertNotNull(actual.getDate());
Assert.assertNotNull(actual.getCalendar());
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
Reported by PMD.
Line: 43
Assert.assertNotNull(actual);
Assert.assertNotNull(actual.getDate());
Assert.assertNotNull(actual.getCalendar());
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
}
Reported by PMD.
Line: 45
Assert.assertNotNull(actual.getDate());
Assert.assertNotNull(actual.getCalendar());
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
}
public static class Model {
Reported by PMD.
Line: 47
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
}
public static class Model {
private Date date;
private Calendar calendar;
Reported by PMD.
Line: 47
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
}
public static class Model {
private Date date;
private Calendar calendar;
Reported by PMD.
Line: 47
Assert.assertEquals("与序列化前比较不相等", original.getDate(), actual.getDate());
Assert.assertEquals("序列化后的Date 和 Calendar 不相等", actual.getDate(), actual.getCalendar().getTime());
}
public static class Model {
private Date date;
private Calendar calendar;
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/bug/Bug_for_issue_304.java
11 issues
Line: 11
public class Bug_for_issue_304 extends TestCase {
public void test_doubleQuote() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_doubleQuote_vo() throws Exception {
Reported by PMD.
Line: 13
public void test_doubleQuote() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_doubleQuote_vo() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
Reported by PMD.
Line: 13
public void test_doubleQuote() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_doubleQuote_vo() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
Reported by PMD.
Line: 16
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_doubleQuote_vo() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
}
public void test_doubleQuote_vo_private() throws Exception {
Reported by PMD.
Line: 18
public void test_doubleQuote_vo() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
}
public void test_doubleQuote_vo_private() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, V1.class).value);
Reported by PMD.
Line: 21
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
}
public void test_doubleQuote_vo_private() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, V1.class).value);
}
public void test_singleQuote() throws Exception {
Reported by PMD.
Line: 23
public void test_doubleQuote_vo_private() throws Exception {
String ss = "{\"value\":\"Intki_E96?\u001A Build\"}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, V1.class).value);
}
public void test_singleQuote() throws Exception {
String ss = "{'value':'Intki_E96?\u001A Build'}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
Reported by PMD.
Line: 26
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, V1.class).value);
}
public void test_singleQuote() throws Exception {
String ss = "{'value':'Intki_E96?\u001A Build'}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_singleQuote_vo() throws Exception {
Reported by PMD.
Line: 28
public void test_singleQuote() throws Exception {
String ss = "{'value':'Intki_E96?\u001A Build'}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_singleQuote_vo() throws Exception {
String ss = "{'value':'Intki_E96?\u001A Build'}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
Reported by PMD.
Line: 31
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss).get("value"));
}
public void test_singleQuote_vo() throws Exception {
String ss = "{'value':'Intki_E96?\u001A Build'}";
Assert.assertEquals("Intki_E96?\u001A Build", JSON.parseObject(ss, VO.class).value);
}
public static class VO {
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_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_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.