The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1600/Issue1683.java
9 issues
Line: 9
import junit.framework.TestCase;
public class Issue1683 extends TestCase {
public void test_for_issue() throws Exception {
String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Issue1683 extends TestCase {
public void test_for_issue() throws Exception {
String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
Reported by PMD.
Line: 12
public void test_for_issue() throws Exception {
String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
Reported by PMD.
Line: 12
public void test_for_issue() throws Exception {
String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
Reported by PMD.
Line: 13
String line = "[2, \"浪漫奇侠\", \"雨天不打伞\", 4536]";
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
@JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
Reported by PMD.
Line: 14
BookDO book = JSON.parseObject(line, BookDO.class, Feature.SupportArrayToBean);
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
@JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
public static class BookDO {
Reported by PMD.
Line: 15
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
@JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
public static class BookDO {
Reported by PMD.
Line: 15
assertEquals(2L, book.bookId.longValue());
assertEquals("浪漫奇侠", book.bookName);
assertEquals("雨天不打伞", book.authorName);
assertEquals(4536, book.wordCount.intValue());
}
@JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
public static class BookDO {
Reported by PMD.
Line: 19
}
@JSONType(orders = {"bookId", "bookName", "authorName", "wordCount"})
public static class BookDO {
private Long bookId;
private String bookName;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest6.java
9 issues
Line: 13
public class JSONFieldTest6 extends TestCase {
public void test_for_issue1()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map1 = new HashMap();
map1.put( 111,666 );
nonStringMap.setMap1( map1 );
Reported by PMD.
Line: 20
map1.put( 111,666 );
nonStringMap.setMap1( map1 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map1\":{\"111\":666}}", json );
}
public void test_for_issue2()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 23
assertEquals( "{\"map1\":{\"111\":666}}", json );
}
public void test_for_issue2()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map2 = new HashMap();
map2.put( 222,888 );
nonStringMap.setMap2( map2 );
Reported by PMD.
Line: 30
map2.put( 222,888 );
nonStringMap.setMap2( map2 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map2\":{222:\"888\"}}", json );
}
public void test_for_issue3()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 33
assertEquals( "{\"map2\":{222:\"888\"}}", json );
}
public void test_for_issue3()
{
NonStringMap nonStringMap = new NonStringMap();
Map<Integer, Integer> map3 = new HashMap();
map3.put( 333,999 );
nonStringMap.setMap3( map3 );
Reported by PMD.
Line: 40
map3.put( 333,999 );
nonStringMap.setMap3( map3 );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
}
public void test_for_issue4()
{
NonStringMap nonStringMap = new NonStringMap();
Reported by PMD.
Line: 43
assertEquals( "{\"map3\":{\"333\":\"999\"}}", json );
}
public void test_for_issue4()
{
NonStringMap nonStringMap = new NonStringMap();
Bean person = new Bean();
person.setAge( 23 );
nonStringMap.setPerson( person );
Reported by PMD.
Line: 50
person.setAge( 23 );
nonStringMap.setPerson( person );
String json = JSON.toJSONString( nonStringMap );
assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
}
class NonStringMap
{
@JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )
Reported by PMD.
Line: 53
assertEquals( "{\"person\":{\"age\":\"23\"}}", json );
}
class NonStringMap
{
@JSONField( serialzeFeatures = {SerializerFeature.WriteNonStringKeyAsString} )
private Map map1;
public Map getMap1()
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/IntFieldTest2.java
9 issues
Line: 17
public class IntFieldTest2 extends TestCase {
public void test_model() throws Exception {
Model model = new Model();
model.id = -1001;
model.id2 = -1002;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 26
Assert.assertEquals("{\"id\":-1001,\"id2\":-1002}", text);
}
public void test_model_max() throws Exception {
Model model = new Model();
model.id = Integer.MIN_VALUE;
model.id2 = Integer.MAX_VALUE;
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 42
}
}
public void test_model_map() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}}";
JSONReader reader = new JSONReader(new StringReader(text));
Map<String, Model> map = reader.readObject(new TypeReference<Map<String, Model>>() {
});
Reported by PMD.
Line: 54
reader.close();
}
public void test_model_map_error() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
Reported by PMD.
Line: 68
Assert.assertNotNull(error);
}
public void test_model_map_error_2() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
Reported by PMD.
Line: 84
public static class Model {
public int id;
public int id2;
}
}
Reported by PMD.
Line: 85
public static class Model {
public int id;
public int id2;
}
}
Reported by PMD.
Line: 57
public void test_model_map_error() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
reader.readObject(new TypeReference<Map<String, Model>>() {
});
} catch (JSONException ex) {
Reported by PMD.
Line: 71
public void test_model_map_error_2() throws Exception {
String text = "{\"model\":{\"id\":-1001,\"id2\":-1002}[";
Exception error = null;
JSONReader reader = new JSONReader(new StringReader(text));
try {
reader.readObject(new TypeReference<Map<String, Model>>() {
});
} catch (JSONException ex) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1600/Issue_for_gaorui.java
9 issues
Line: 8
import junit.framework.TestCase;
public class Issue_for_gaorui extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
Reported by PMD.
Line: 8
import junit.framework.TestCase;
public class Issue_for_gaorui extends TestCase {
public void test_for_issue() throws Exception {
String json = "{\"@type\":\"java.util.HashMap\",\"COUPON\":[{\"@type\":\"com.alibaba.json.bvt.issue_1600.Issue_for_gaorui.PromotionTermDetail\",\"activityId\":\"1584034\",\"choose\":true,\"couponId\":1251068987,\"couponType\":\"limitp\",\"match\":true,\"realPrice\":{\"amount\":0.6,\"currency\":\"USD\"}}],\"grayTrade\":\"true\"}";
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
Reported by PMD.
Line: 14
JSON.parseObject(json, Object.class, Feature.SupportAutoType);
}
public static class PromotionTermDetail {
/**
* 卡券Id
*/
private Long couponId;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 40
/**
* 是否能够获取到该优惠
*/
private boolean isMatch = false;
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.
Line: 44
/**
* 是否选择了该优惠
*/
private boolean isChoose = false;
/**
* 未获取到优惠的原因
*/
private String reasonForLose;
/**
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_0.java
9 issues
Line: 10
public class JSONFieldTest_unwrapped_0 extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.id = 123;
vo.localtion = new Localtion(127, 37);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 10
public class JSONFieldTest_unwrapped_0 extends TestCase {
public void test_jsonField() throws Exception {
VO vo = new VO();
vo.id = 123;
vo.localtion = new Localtion(127, 37);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 19
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
public int id;
Reported by PMD.
Line: 21
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.localtion);
assertEquals(vo.localtion.latitude, vo2.localtion.latitude);
assertEquals(vo.localtion.longitude, vo2.localtion.longitude);
}
public static class VO {
public int id;
Reported by PMD.
Line: 25
}
public static class VO {
public int id;
@JSONField(unwrapped = true)
public Localtion localtion;
}
Reported by PMD.
Line: 28
public int id;
@JSONField(unwrapped = true)
public Localtion localtion;
}
public static class Localtion {
public int longitude;
public int latitude;
Reported by PMD.
Line: 32
}
public static class Localtion {
public int longitude;
public int latitude;
public Localtion() {
}
Reported by PMD.
Line: 33
public static class Localtion {
public int longitude;
public int latitude;
public Localtion() {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue87_hashset.java
9 issues
Line: 18
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
Reported by PMD.
Line: 13
public class Issue87_hashset extends TestCase {
public void test_for_issue() throws Exception {
TestObject to = new TestObject();
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
Reported by PMD.
Line: 13
public class Issue87_hashset extends TestCase {
public void test_for_issue() throws Exception {
TestObject to = new TestObject();
to.add("test1");
to.add("test2");
String text = JSON.toJSONString(to);
System.out.println(text);
Reported by PMD.
Line: 20
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
Reported by PMD.
Line: 25
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
public HashSet<String> getSet() {
return set;
}
Reported by PMD.
Line: 27
private HashSet<String> set = new HashSet<String>(0);
public HashSet<String> getSet() {
return set;
}
public void setSet(HashSet<String> set) {
this.set = set;
Reported by PMD.
Line: 31
return set;
}
public void setSet(HashSet<String> set) {
this.set = set;
}
public void add(String str) {
set.add(str);
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.bug;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
Reported by PMD.
Line: 20
String text = JSON.toJSONString(to);
System.out.println(text);
JSONObject jo = JSON.parseObject(text);
to = JSON.toJavaObject(jo, TestObject.class);
}
public static class TestObject {
private HashSet<String> set = new HashSet<String>(0);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_Object_2_public.java
9 issues
Line: 13
public class WriteAsArray_Object_2_public extends TestCase {
public void test_0() throws Exception {
A a = new A();
a.setId(123);
a.setName("wenshao");
VO vo = new VO();
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 26
Assert.assertEquals("[1001,[123,\"wenshao\"]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getValue().getId(), vo2.getValue().getId());
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
Reported by PMD.
Line: 30
Assert.assertEquals(vo.getValue().getName(), vo2.getValue().getName());
}
public static class VO {
private int id;
private A value;
public int getId() {
Reported by PMD.
Line: 53
}
public static class A {
private int id;
private String name;
public int getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_issue_184.java
9 issues
Line: 22
SerializeConfig.getGlobalInstance().setAsmEnable(false);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
// 输出{"@type":"xx.TUser","id":0L}
System.out.println(json);
// 下面反系列化错误:com.alibaba.fastjson.JSONException: unclosed.str
// 原因:id带L后缀
user = (TUser) JSON.parse(json);
}
Reported by PMD.
Line: 11
import junit.framework.TestCase;
public class Bug_for_issue_184 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_184");
}
public void test_for_issue() throws Exception {
TUser user = new TUser();
Reported by PMD.
Line: 12
public class Bug_for_issue_184 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_184");
}
public void test_for_issue() throws Exception {
TUser user = new TUser();
user.id = 1001;
Reported by PMD.
Line: 15
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_184");
}
public void test_for_issue() throws Exception {
TUser user = new TUser();
user.id = 1001;
// 禁用asm(在android下使用),启用asm则没问题。
SerializeConfig.getGlobalInstance().setAsmEnable(false);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 15
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_issue_184");
}
public void test_for_issue() throws Exception {
TUser user = new TUser();
user.id = 1001;
// 禁用asm(在android下使用),启用asm则没问题。
SerializeConfig.getGlobalInstance().setAsmEnable(false);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
Reported by PMD.
Line: 19
TUser user = new TUser();
user.id = 1001;
// 禁用asm(在android下使用),启用asm则没问题。
SerializeConfig.getGlobalInstance().setAsmEnable(false);
String json = JSON.toJSONString(user, SerializerFeature.WriteClassName);
// 输出{"@type":"xx.TUser","id":0L}
System.out.println(json);
// 下面反系列化错误:com.alibaba.fastjson.JSONException: unclosed.str
// 原因:id带L后缀
Reported by PMD.
Line: 25
System.out.println(json);
// 下面反系列化错误:com.alibaba.fastjson.JSONException: unclosed.str
// 原因:id带L后缀
user = (TUser) JSON.parse(json);
}
public static class TUser {
public long id;
Reported by PMD.
Line: 30
public static class TUser {
public long id;
}
}
Reported by PMD.
Line: 25
System.out.println(json);
// 下面反系列化错误:com.alibaba.fastjson.JSONException: unclosed.str
// 原因:id带L后缀
user = (TUser) JSON.parse(json);
}
public static class TUser {
public long id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/array/FieldFloatArray2Test_private.java
9 issues
Line: 10
* Created by wenshao on 11/01/2017.
*/
public class FieldFloatArray2Test_private extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
Reported by PMD.
Line: 10
* Created by wenshao on 11/01/2017.
*/
public class FieldFloatArray2Test_private extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
Reported by PMD.
Line: 12
public class FieldFloatArray2Test_private extends TestCase {
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
Reported by PMD.
Line: 13
public void test_intArray() throws Exception {
Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
}
Reported by PMD.
Line: 14
Model model = JSON.parseObject("{\"value\":[[1,2.1,-0.3]]}", Model.class);
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
}
Reported by PMD.
Line: 15
assertNotNull(model.value);
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
}
private static class Model {
Reported by PMD.
Line: 16
assertEquals(1, model.value.length);
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
}
private static class Model {
public float[][] value;
Reported by PMD.
Line: 17
assertEquals(3, model.value[0].length);
assertEquals(1f, model.value[0][0]);
assertEquals(2.1f, model.value[0][1]);
assertEquals(-0.3f, model.value[0][2]);
}
private static class Model {
public float[][] value;
}
Reported by PMD.
Line: 21
}
private static class Model {
public float[][] value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1600/Issue1653.java
9 issues
Line: 14
import java.util.Map;
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
Reported by PMD.
Line: 24
config.putDeserializer(Map.class, deserializer);
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 25
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 25
CaseInsensitiveMap<String, Object> root = (CaseInsensitiveMap) JSON.parseObject("{\"val\":{}}", Map.class, config, Feature.CustomMapDeserializer);
CaseInsensitiveMap subMap = (CaseInsensitiveMap) root.get("val");
assertEquals(0, subMap.size());
}
}
Reported by PMD.
Line: 8
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.parser.deserializer.MapDeserializer;
import junit.framework.TestCase;
import org.apache.commons.collections4.map.*;
import java.lang.reflect.Type;
import java.util.Map;
public class Issue1653 extends TestCase {
Reported by PMD.
Line: 15
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
Reported by PMD.
Line: 15
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
Reported by PMD.
Line: 16
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
config.putDeserializer(Map.class, deserializer);
Reported by PMD.
Line: 16
public class Issue1653 extends TestCase {
public void test_for_issue() throws Exception {
ParserConfig config = new ParserConfig();
MapDeserializer deserializer = new MapDeserializer() {
public Map<Object, Object> createMap(Type type) {
return new CaseInsensitiveMap();
}
};
config.putDeserializer(Map.class, deserializer);
Reported by PMD.