The following issues were found
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_List3.java
11 issues
Line: 15
public class WriteClassNameTest_List3 extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
List tables = new ArrayList();
tables.add(new ExtTable(1001));
tables.add(new Table());
model.setTables(tables);
Reported by PMD.
Line: 15
public class WriteClassNameTest_List3 extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
List tables = new ArrayList();
tables.add(new ExtTable(1001));
tables.add(new Table());
model.setTables(tables);
Reported by PMD.
Line: 23
model.setTables(tables);
String json = JSON.toJSONString(model);
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
Reported by PMD.
Line: 26
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private List<? extends Table> tables;
Reported by PMD.
Line: 26
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private List<? extends Table> tables;
Reported by PMD.
Line: 26
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private List<? extends Table> tables;
Reported by PMD.
Line: 26
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private List<? extends Table> tables;
Reported by PMD.
Line: 26
assertEquals("{\"tables\":[{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_List3$ExtTable\",\"id\":1001},{}]}", json);
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().iterator().next().getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private List<? extends Table> tables;
Reported by PMD.
Line: 47
}
public static class ExtTable extends Table {
public int id;
public ExtTable() {
}
Reported by PMD.
Line: 9
import junit.framework.TestCase;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class WriteClassNameTest_List3 extends TestCase {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/UUIDFieldTest.java
11 issues
Line: 14
public class UUIDFieldTest extends TestCase {
public void test_codec() throws Exception {
User user = new User();
user.setValue(UUID.randomUUID());
SerializeConfig mapping = new SerializeConfig();
mapping.setAsmEnable(false);
Reported by PMD.
Line: 24
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_upper_case() throws Exception {
User user = new User();
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
Reported by PMD.
Line: 26
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_upper_case() throws Exception {
User user = new User();
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Reported by PMD.
Line: 27
Assert.assertEquals(user1.getValue(), user.getValue());
}
public void test_codec_upper_case() throws Exception {
User user = new User();
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
Reported by PMD.
Line: 32
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 32
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 32
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 32
String text ="{\"value\":\"79104776-6CA7-4E41-948F-4D2ECD06502A\"}";
user = JSON.parseObject(text, User.class);
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
}
public void test_codec_null() throws Exception {
User user = new User();
user.setValue(null);
Reported by PMD.
Line: 35
Assert.assertEquals("79104776-6CA7-4E41-948F-4D2ECD06502A", user.getValue().toString().toUpperCase());
}
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: 45
User user1 = JSON.parseObject(text, User.class);
Assert.assertEquals(user1.getValue(), user.getValue());
}
public static class User {
private UUID value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/DefaultObjectDeserializerTest6.java
11 issues
Line: 17
public class DefaultObjectDeserializerTest6 extends TestCase {
public void test_0() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"$.value.1\"}}}", Entity.class);
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Reported by PMD.
Line: 19
public void test_0() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"$.value.1\"}}}", Entity.class);
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
Reported by PMD.
Line: 19
public void test_0() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"$.value.1\"}}}", Entity.class);
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
Reported by PMD.
Line: 19
public void test_0() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"$.value.1\"}}}", Entity.class);
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
Reported by PMD.
Line: 19
public void test_0() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"$.value.1\"}}}", Entity.class);
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
Reported by PMD.
Line: 22
Assert.assertSame(vo.getValue().get("1"), vo.getValue().get("2"));
}
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
}
public static class Entity {
Reported by PMD.
Line: 24
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
}
public static class Entity {
private final Map<Object, Map<Object, Object>> value;
Reported by PMD.
Line: 24
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
}
public static class Entity {
private final Map<Object, Map<Object, Object>> value;
Reported by PMD.
Line: 24
public void test_1() throws Exception {
Entity vo = JSON.parseObject("{\"value\":{\"1\":{},\"2\":{\"$ref\":\"..\"}}}", Entity.class);
Assert.assertSame(vo.getValue(), vo.getValue().get("2"));
}
public static class Entity {
private final Map<Object, Map<Object, Object>> value;
Reported by PMD.
Line: 3
package com.alibaba.json.bvt.parser.deser;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import org.junit.Assert;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/BigIntegerDeserializerTest.java
11 issues
Line: 14
public class BigIntegerDeserializerTest extends TestCase {
public void test_1() throws Exception {
BigInteger value = JSON.parseObject("'123'", BigInteger.class);
Assert.assertEquals(new BigInteger("123"), value);
}
Reported by PMD.
Line: 18
BigInteger value = JSON.parseObject("'123'", BigInteger.class);
Assert.assertEquals(new BigInteger("123"), value);
}
public void test_vo() throws Exception {
VO vo = JSON.parseObject("{\"value\":123}", VO.class);
Reported by PMD.
Line: 21
Assert.assertEquals(new BigInteger("123"), value);
}
public void test_vo() throws Exception {
VO vo = JSON.parseObject("{\"value\":123}", VO.class);
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
Reported by PMD.
Line: 25
VO vo = JSON.parseObject("{\"value\":123}", VO.class);
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
public void test_vo_null() throws Exception {
VO vo = JSON.parseObject("{\"value\":null}", VO.class);
Reported by PMD.
Line: 28
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
public void test_vo_null() throws Exception {
VO vo = JSON.parseObject("{\"value\":null}", VO.class);
Assert.assertEquals(null, vo.getValue());
}
Reported by PMD.
Line: 32
VO vo = JSON.parseObject("{\"value\":null}", VO.class);
Assert.assertEquals(null, vo.getValue());
}
public void test_vo2() throws Exception {
VO2 vo = JSON.parseObject("{\"value\":123}", VO2.class);
Reported by PMD.
Line: 35
Assert.assertEquals(null, vo.getValue());
}
public void test_vo2() throws Exception {
VO2 vo = JSON.parseObject("{\"value\":123}", VO2.class);
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
Reported by PMD.
Line: 39
VO2 vo = JSON.parseObject("{\"value\":123}", VO2.class);
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
public void test_array() throws Exception {
List<BigInteger> list = JSON.parseArray("[123,345]", BigInteger.class);
Assert.assertEquals(new BigInteger("123"), list.get(0));
Reported by PMD.
Line: 42
Assert.assertEquals(new BigInteger("123"), vo.getValue());
}
public void test_array() throws Exception {
List<BigInteger> list = JSON.parseArray("[123,345]", BigInteger.class);
Assert.assertEquals(new BigInteger("123"), list.get(0));
Assert.assertEquals(new BigInteger("345"), list.get(1));
}
Reported by PMD.
Line: 44
public void test_array() throws Exception {
List<BigInteger> list = JSON.parseArray("[123,345]", BigInteger.class);
Assert.assertEquals(new BigInteger("123"), list.get(0));
Assert.assertEquals(new BigInteger("345"), list.get(1));
}
public static class VO {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/TestExternal3.java
10 issues
Line: 32
method.invoke(obj, "jobs");
String text = JSON.toJSONString(obj, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, clazz, confg);
String clazzName = JSON.parse(text, confg).getClass().getName();
Assert.assertEquals(clazz.getName(), clazzName);
}
Reported by PMD.
Line: 19
public class TestExternal3 extends TestCase {
ParserConfig confg = ParserConfig.global;
protected void setUp() throws Exception {
confg.addAccept("external.VO");
}
public void test_0 () throws Exception {
Reported by PMD.
Line: 20
public class TestExternal3 extends TestCase {
ParserConfig confg = ParserConfig.global;
protected void setUp() throws Exception {
confg.addAccept("external.VO");
}
public void test_0 () throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
Reported by PMD.
Line: 24
confg.addAccept("external.VO");
}
public void test_0 () throws Exception {
ExtClassLoader classLoader = new ExtClassLoader();
Class<?> clazz = classLoader.loadClass("external.VO");
Method method = clazz.getMethod("setName", new Class[] {String.class});
Object obj = clazz.newInstance();
method.invoke(obj, "jobs");
Reported by PMD.
Line: 28
ExtClassLoader classLoader = new ExtClassLoader();
Class<?> clazz = classLoader.loadClass("external.VO");
Method method = clazz.getMethod("setName", new Class[] {String.class});
Object obj = clazz.newInstance();
method.invoke(obj, "jobs");
String text = JSON.toJSONString(obj, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, clazz, confg);
Reported by PMD.
Line: 34
String text = JSON.toJSONString(obj, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, clazz, confg);
String clazzName = JSON.parse(text, confg).getClass().getName();
Assert.assertEquals(clazz.getName(), clazzName);
}
public static class ExtClassLoader extends ClassLoader {
public ExtClassLoader() throws IOException{
Reported by PMD.
Line: 34
String text = JSON.toJSONString(obj, SerializerFeature.WriteClassName);
System.out.println(text);
JSON.parseObject(text, clazz, confg);
String clazzName = JSON.parse(text, confg).getClass().getName();
Assert.assertEquals(clazz.getName(), clazzName);
}
public static class ExtClassLoader extends ClassLoader {
public ExtClassLoader() throws IOException{
Reported by PMD.
Line: 35
System.out.println(text);
JSON.parseObject(text, clazz, confg);
String clazzName = JSON.parse(text, confg).getClass().getName();
Assert.assertEquals(clazz.getName(), clazzName);
}
public static class ExtClassLoader extends ClassLoader {
public ExtClassLoader() throws IOException{
super(Thread.currentThread().getContextClassLoader());
Reported by PMD.
Line: 43
super(Thread.currentThread().getContextClassLoader());
byte[] bytes;
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("external/VO.clazz");
bytes = IOUtils.toByteArray(is);
is.close();
super.defineClass("external.VO", bytes, 0, bytes.length);
}
Reported by PMD.
Line: 14
import org.apache.commons.io.IOUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
public class TestExternal3 extends TestCase {
ParserConfig confg = ParserConfig.global;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/mixins/MixinSerForFieldsTest.java
10 issues
Line: 20
}
}
abstract class MixIn {
@JSONField(serialize = false)
public String a;
@JSONField(name = "banana")
public String b;
}
Reported by PMD.
Line: 11
public class MixinSerForFieldsTest extends TestCase {
static class BeanClass {
public String a;
public String b;
public BeanClass(String a, String b) {
this.a = a;
this.b = b;
Reported by PMD.
Line: 12
public class MixinSerForFieldsTest extends TestCase {
static class BeanClass {
public String a;
public String b;
public BeanClass(String a, String b) {
this.a = a;
this.b = b;
}
Reported by PMD.
Line: 20
}
}
abstract class MixIn {
@JSONField(serialize = false)
public String a;
@JSONField(name = "banana")
public String b;
}
Reported by PMD.
Line: 27
public String b;
}
public void test() throws Exception{
BeanClass bean = new BeanClass("1", "2");
JSON.addMixInAnnotations(BeanClass.class, MixIn.class);
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
Reported by PMD.
Line: 27
public String b;
}
public void test() throws Exception{
BeanClass bean = new BeanClass("1", "2");
JSON.addMixInAnnotations(BeanClass.class, MixIn.class);
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
Reported by PMD.
Line: 33
JSON.addMixInAnnotations(BeanClass.class, MixIn.class);
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
assertEquals(1, result.size());
assertEquals("2", result.get("banana"));
JSON.removeMixInAnnotations(BeanClass.class);
}
}
Reported by PMD.
Line: 33
JSON.addMixInAnnotations(BeanClass.class, MixIn.class);
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
assertEquals(1, result.size());
assertEquals("2", result.get("banana"));
JSON.removeMixInAnnotations(BeanClass.class);
}
}
Reported by PMD.
Line: 34
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
assertEquals(1, result.size());
assertEquals("2", result.get("banana"));
JSON.removeMixInAnnotations(BeanClass.class);
}
}
Reported by PMD.
Line: 34
String jsonString = JSON.toJSONString(bean);
JSONObject result = JSON.parseObject(jsonString);
assertEquals(1, result.size());
assertEquals("2", result.get("banana"));
JSON.removeMixInAnnotations(BeanClass.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SpecialTest.java
10 issues
Line: 16
count++;
}
}
System.out.println(count);
}
final static long flags;
static {
long val = 0L;
Reported by PMD.
Line: 5
import com.alibaba.fastjson.serializer.SerializerFeature;
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
Reported by PMD.
Line: 7
public class SpecialTest {
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
Reported by PMD.
Line: 28
}
static boolean isSpecial(char ch) {
if (ch <= 31) {
return true;
}
if (ch > '\\') { // 92
return false;
Reported by PMD.
Line: 32
return true;
}
if (ch > '\\') { // 92
return false;
}
return ((1L << (ch - 31)) & flags) != 0;
}
Reported by PMD.
Line: 44
// return false;
// }
if (ch == ' ') { // 32
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
Reported by PMD.
Line: 48
return false;
}
if (ch == '/') { // 47
return SerializerFeature.isEnabled(features, SerializerFeature.WriteSlashAsSpecial);
}
if (ch > '#' // 35
&& ch != '\\' // 92
Reported by PMD.
Line: 58
return false;
}
if (ch <= 0x1F // 31
|| ch == '\\' // 92
|| ch == '"' // 34
) {
return true;
}
Reported by PMD.
Line: 9
public static void main(String[] args) throws Exception {
int count = 0;
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
Reported by PMD.
Line: 13
for (int i = 0; i < 1000; ++i) {
char ch = (char) i;
if(isSpecial(ch)) {
count++;
}
}
System.out.println(count);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/MapTest.java
10 issues
Line: 25
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
VO vo2 = (VO) JSON.parse(text);
Assert.assertEquals(vo.getValue(), vo2.getValue());
}
Reported by PMD.
Line: 39
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
VO vo2 = (VO) JSON.parse(text);
Assert.assertEquals(vo.getValue(), vo2.getValue());
}
Reported by PMD.
Line: 15
import com.alibaba.fastjson.serializer.SerializerFeature;
public class MapTest extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.MapTest");
}
public void test_map() throws Exception {
VO vo = new VO();
Reported by PMD.
Line: 16
public class MapTest extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.MapTest");
}
public void test_map() throws Exception {
VO vo = new VO();
vo.getValue().put("1", "AA");
Reported by PMD.
Line: 19
ParserConfig.global.addAccept("com.alibaba.json.bvt.writeClassName.MapTest");
}
public void test_map() throws Exception {
VO vo = new VO();
vo.getValue().put("1", "AA");
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 21
public void test_map() throws Exception {
VO vo = new VO();
vo.getValue().put("1", "AA");
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
Line: 29
VO vo2 = (VO) JSON.parse(text);
Assert.assertEquals(vo.getValue(), vo2.getValue());
}
public void test_map_2() throws Exception {
VO vo = new VO();
vo.setValue(new TreeMap<String, Object>());
Reported by PMD.
Line: 32
Assert.assertEquals(vo.getValue(), vo2.getValue());
}
public void test_map_2() throws Exception {
VO vo = new VO();
vo.setValue(new TreeMap<String, Object>());
vo.getValue().put("1", "AA");
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 35
public void test_map_2() throws Exception {
VO vo = new VO();
vo.setValue(new TreeMap<String, Object>());
vo.getValue().put("1", "AA");
String text = JSON.toJSONString(vo, SerializerFeature.WriteClassName);
System.out.println(text);
Reported by PMD.
Line: 43
VO vo2 = (VO) JSON.parse(text);
Assert.assertEquals(vo.getValue(), vo2.getValue());
}
private static class VO {
private Map<String, Object> value = new HashMap<String, Object>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue1017.java
10 issues
Line: 13
* Created by wenshao on 11/02/2017.
*/
public class Issue1017 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
Reported by PMD.
Line: 13
* Created by wenshao on 11/02/2017.
*/
public class Issue1017 extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
Reported by PMD.
Line: 17
String json = "{\"pictureList\":[\"http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000\",\"http://common.cnblogs.com/images/icon_weibo_24.png\"]}";
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
Reported by PMD.
Line: 18
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
Reported by PMD.
Line: 18
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
Reported by PMD.
Line: 19
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
Reported by PMD.
Line: 19
User user = JSON.parseObject(json, User.class);
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
Reported by PMD.
Line: 20
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
Reported by PMD.
Line: 20
assertNotNull(user.pictureList);
assertEquals(2, user.pictureList.size());
assertEquals("http://static.oschina.net/uploads/user/1218/2437072_100.jpg?t=1461076033000", user.pictureList.get(0));
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
Reported by PMD.
Line: 23
assertEquals("http://common.cnblogs.com/images/icon_weibo_24.png", user.pictureList.get(1));
}
public static class User implements Serializable {
private List<String> pictureList;
public List<String> getPictureList() {
return pictureList;
}
public User setPictureList(List<String> pictureList) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/creator/JSONCreatorTest_double_obj.java
10 issues
Line: 14
public class JSONCreatorTest_double_obj extends TestCase {
public void test_create() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
String text = JSON.toJSONString(entity);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Reported by PMD.
Line: 19
String text = JSON.toJSONString(entity);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public void test_create_2() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
Reported by PMD.
Line: 19
String text = JSON.toJSONString(entity);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public void test_create_2() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
Reported by PMD.
Line: 19
String text = JSON.toJSONString(entity);
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public void test_create_2() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
Reported by PMD.
Line: 20
Entity entity2 = JSON.parseObject(text, Entity.class);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public void test_create_2() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
String text = JSON.toJSONString(entity);
Reported by PMD.
Line: 23
Assert.assertEquals(entity.getName(), entity2.getName());
}
public void test_create_2() throws Exception {
Entity entity = new Entity(123.45D, "菜姐");
String text = JSON.toJSONString(entity);
ParserConfig config = new ParserConfig();
Reported by PMD.
Line: 30
ParserConfig config = new ParserConfig();
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
Reported by PMD.
Line: 30
ParserConfig config = new ParserConfig();
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
Reported by PMD.
Line: 30
ParserConfig config = new ParserConfig();
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
Reported by PMD.
Line: 31
Entity entity2 = JSON.parseObject(text, Entity.class, config, 0);
Assert.assertTrue(entity.getId().doubleValue() == entity2.getId().doubleValue());
Assert.assertEquals(entity.getName(), entity2.getName());
}
public static class Entity {
private final Double id;
Reported by PMD.