The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/JSONFieldTest_unwrapped_2.java
9 issues
Line: 13
public class JSONFieldTest_unwrapped_2 extends TestCase {
public void test_jsonField() throws Exception {
String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
Reported by PMD.
Line: 13
public class JSONFieldTest_unwrapped_2 extends TestCase {
public void test_jsonField() throws Exception {
String text = "{\"id\":123,\"latitude\":37,\"longitude\":127}";
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
Reported by PMD.
Line: 18
Assert.assertEquals("{\"id\":123,\"latitude\":37,\"longitude\":127}", text);
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
Reported by PMD.
Line: 19
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
Reported by PMD.
Line: 19
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
public int id;
Reported by PMD.
Line: 20
VO vo2 = JSON.parseObject(text, VO.class);
assertNotNull(vo2.properties);
assertEquals(37, vo2.properties.get("latitude"));
assertEquals(127, vo2.properties.get("longitude"));
}
public static class VO {
public int id;
Reported by PMD.
Line: 27
public static class VO {
public int id;
private Map<String, Object> properties = new LinkedHashMap<String, Object>();
@JSONField(unwrapped = true)
public void setProperty(String key, Object value) {
properties.put(key, value);
}
Reported by PMD.
Line: 27
public static class VO {
public int id;
private Map<String, Object> properties = new LinkedHashMap<String, Object>();
@JSONField(unwrapped = true)
public void setProperty(String key, Object value) {
properties.put(key, value);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_lenolix_8.java
9 issues
Line: 41
String mapJson = JSON.toJSONString(map, SerializerFeature.WriteClassName, SerializerFeature.WriteMapNullValue);
System.out.println(mapJson);
Object object = JSON.parse(mapJson);
}
Reported by PMD.
Line: 18
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Bug_for_lenolix_8 extends TestCase {
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_8.");
}
Reported by PMD.
Line: 22
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_8.");
}
public void test_for_objectKey() throws Exception {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", JSON.defaultLocale);
simpleDateFormat.setTimeZone(JSON.defaultTimeZone);
Reported by PMD.
Line: 25
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_8.");
}
public void test_for_objectKey() throws Exception {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", JSON.defaultLocale);
simpleDateFormat.setTimeZone(JSON.defaultTimeZone);
Map<Integer, User> map = new HashMap<Integer, User>();
User user = new User();
Reported by PMD.
Line: 25
com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_8.");
}
public void test_for_objectKey() throws Exception {
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", JSON.defaultLocale);
simpleDateFormat.setTimeZone(JSON.defaultTimeZone);
Map<Integer, User> map = new HashMap<Integer, User>();
User user = new User();
Reported by PMD.
Line: 35
user.setIsBoy(true);
user.setName("leno.lix");
user.setBirthDay(simpleDateFormat.parse("2012-03-07 22:38:21"));
user.setGmtCreate(new java.sql.Date(simpleDateFormat.parse("2012-02-03 22:38:21").getTime()));
map.put(1, user);
String mapJson = JSON.toJSONString(map, SerializerFeature.WriteClassName, SerializerFeature.WriteMapNullValue);
Reported by PMD.
Line: 43
System.out.println(mapJson);
Object object = JSON.parse(mapJson);
}
public static class User implements Serializable {
Reported by PMD.
Line: 47
}
public static class User implements Serializable {
/**
*
*/
Reported by PMD.
Line: 43
System.out.println(mapJson);
Object object = JSON.parse(mapJson);
}
public static class User implements Serializable {
Reported by PMD.
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/bug/Bug_for_lenolix_10.java
9 issues
Line: 29
// .getTime()));
map2.put(1, user);
String mapJson2 = JSON.toJSONString(map2, SerializerFeature.WriteClassName, SerializerFeature.WriteMapNullValue);
System.out.println(mapJson2);
Object object2 = JSON.parse(mapJson2);
}
public static class User {
Reported by PMD.
Line: 14
import com.alibaba.fastjson.serializer.SerializerFeature;
public class Bug_for_lenolix_10 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_10.");
}
public void test_for_objectKey() throws Exception {
Map<Integer, User> map2 = new HashMap<Integer, User>();
Reported by PMD.
Line: 15
public class Bug_for_lenolix_10 extends TestCase {
protected void setUp() throws Exception {
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_10.");
}
public void test_for_objectKey() throws Exception {
Map<Integer, User> map2 = new HashMap<Integer, User>();
User user = new User();
Reported by PMD.
Line: 18
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_10.");
}
public void test_for_objectKey() throws Exception {
Map<Integer, User> map2 = new HashMap<Integer, User>();
User user = new User();
user.setId(1);
user.setIsBoy(true);
user.setName("leno.lix");
Reported by PMD.
Line: 18
ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_10.");
}
public void test_for_objectKey() throws Exception {
Map<Integer, User> map2 = new HashMap<Integer, User>();
User user = new User();
user.setId(1);
user.setIsBoy(true);
user.setName("leno.lix");
Reported by PMD.
Line: 30
map2.put(1, user);
String mapJson2 = JSON.toJSONString(map2, SerializerFeature.WriteClassName, SerializerFeature.WriteMapNullValue);
System.out.println(mapJson2);
Object object2 = JSON.parse(mapJson2);
}
public static class User {
Reported by PMD.
Line: 34
}
public static class User {
private int id;
private Boolean isBoy;
private String name;
Reported by PMD.
Line: 7
import java.util.Map;
import com.alibaba.fastjson.parser.ParserConfig;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
Reported by PMD.
Line: 30
map2.put(1, user);
String mapJson2 = JSON.toJSONString(map2, SerializerFeature.WriteClassName, SerializerFeature.WriteMapNullValue);
System.out.println(mapJson2);
Object object2 = JSON.parse(mapJson2);
}
public static class User {
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/issue_3400/Issue_20201016_01.java
9 issues
Line: 21
String s = JSON.toJSONString(config, SerializerFeature.WriteMapNullValue,
SerializerFeature.QuoteFieldNames, SerializerFeature.WriteNullListAsEmpty);
System.out.println(s);
}
public void testFastJson() {
String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";
Reported by PMD.
Line: 28
public void testFastJson() {
String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";
System.out.println( JSON.parseObject(s, Config.class));
}
public static class Config {
private UserConfig creator;
private UserConfig owner;
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Issue_20201016_01 extends TestCase {
public void testToString() {
UserConfig user = new UserConfig();
user.setAccount("account");
user.setName("name");
Config config = new Config();
Reported by PMD.
Line: 9
import junit.framework.TestCase;
public class Issue_20201016_01 extends TestCase {
public void testToString() {
UserConfig user = new UserConfig();
user.setAccount("account");
user.setName("name");
Config config = new Config();
Reported by PMD.
Line: 25
}
public void testFastJson() {
String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";
System.out.println( JSON.parseObject(s, Config.class));
}
Reported by PMD.
Line: 25
}
public void testFastJson() {
String s = "{\"agent\":null,\"creator\":{\"account\":\"account\",\"name\":\"name\",\"workid\":null},\"owner\":{\"$ref\":\"$.creator\"}}";
System.out.println( JSON.parseObject(s, Config.class));
}
Reported by PMD.
Line: 31
System.out.println( JSON.parseObject(s, Config.class));
}
public static class Config {
private UserConfig creator;
private UserConfig owner;
private UserConfig agent;
public UserConfig getCreator() {
Reported by PMD.
Line: 56
}
}
public static class UserConfig {
private String workid;
private String name;
private String account;
public String getWorkid() {
Reported by PMD.
Line: 4
package com.alibaba.json.bvt.issue_3400;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONType;
import com.alibaba.fastjson.serializer.SerializerFeature;
import junit.framework.TestCase;
public class Issue_20201016_01 extends TestCase {
public void testToString() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/FieldBasedTest.java
9 issues
Line: 12
* @author TimAndy
*/
public class FieldBasedTest extends TestCase {
public void test_filed_based_parse() {
Student student = new Student("123", "你好世界", 60);
String json = JSON.toJSONString(student, new SerializeConfig(true));
Student result = JSON.parseObject(json, Student.class, new ParserConfig(true));
assertNotNull(result);
Reported by PMD.
Line: 12
* @author TimAndy
*/
public class FieldBasedTest extends TestCase {
public void test_filed_based_parse() {
Student student = new Student("123", "你好世界", 60);
String json = JSON.toJSONString(student, new SerializeConfig(true));
Student result = JSON.parseObject(json, Student.class, new ParserConfig(true));
assertNotNull(result);
Reported by PMD.
Line: 17
String json = JSON.toJSONString(student, new SerializeConfig(true));
Student result = JSON.parseObject(json, Student.class, new ParserConfig(true));
assertNotNull(result);
assertEquals("123", result.id);
assertEquals("你好世界", result.name);
assertEquals(60, result.score);
}
Reported by PMD.
Line: 18
Student result = JSON.parseObject(json, Student.class, new ParserConfig(true));
assertNotNull(result);
assertEquals("123", result.id);
assertEquals("你好世界", result.name);
assertEquals(60, result.score);
}
static final class Student {
Reported by PMD.
Line: 19
assertNotNull(result);
assertEquals("123", result.id);
assertEquals("你好世界", result.name);
assertEquals(60, result.score);
}
static final class Student {
private String id;
Reported by PMD.
Line: 20
assertNotNull(result);
assertEquals("123", result.id);
assertEquals("你好世界", result.name);
assertEquals(60, result.score);
}
static final class Student {
private String id;
private String name;
Reported by PMD.
Line: 24
}
static final class Student {
private String id;
private String name;
private int score;
Student() {
}
Reported by PMD.
Line: 25
static final class Student {
private String id;
private String name;
private int score;
Student() {
}
Reported by PMD.
Line: 26
static final class Student {
private String id;
private String name;
private int score;
Student() {
}
Student(String id, String name, int score) {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/typeRef/TypeReferenceTest6.java
9 issues
Line: 15
public class TypeReferenceTest6 extends TestCase {
public void test_typeRef() throws Exception {
TypeReference<Map<String, Entity>> typeRef = new TypeReference<Map<String, Entity>>() {
};
Map<String, Entity> map = JSON.parseObject(
"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);
Reported by PMD.
Line: 22
Map<String, Entity> map = JSON.parseObject(
"{\"value\":{\"id\":\"abc\",\"list\":[{\"id\":123}]}}", typeRef);
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
Reported by PMD.
Line: 24
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
Reported by PMD.
Line: 25
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 25
Entity entity = map.get("value");
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 26
Assert.assertNotNull(entity);
Assert.assertEquals("abc", entity.getId());
Assert.assertEquals(1, entity.getList().size());
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
Reported by PMD.
Line: 29
Assert.assertEquals(123, entity.getList().get(0).getId());
}
public static class Entity {
private String id;
private List<A> list = new ArrayList<A>();
public String getId() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3400/Issue3453.java
9 issues
Line: 15
*/
public class Issue3453 extends TestCase {
public void test_for_issue() throws Exception {
String str = "[\n" +
" {\n" +
" \"altitude\": 109.0,\n" +
" \"angle\": 5.0,\n" +
" \"index\": 1,\n" +
Reported by PMD.
Line: 17
public void test_for_issue() throws Exception {
String str = "[\n" +
" {\n" +
" \"altitude\": 109.0,\n" +
" \"angle\": 5.0,\n" +
" \"index\": 1,\n" +
" \"type\": 1\n" +
" },\n" +
Reported by PMD.
Line: 22
" \"angle\": 5.0,\n" +
" \"index\": 1,\n" +
" \"type\": 1\n" +
" },\n" +
" {\n" +
" \"altitude\": 1307.0,\n" +
" \"angle\": 5.0,\n" +
" \"index\": 2,\n" +
" \"type\": 1\n" +
Reported by PMD.
Line: 30
" \"type\": 1\n" +
" },\n" +
" {\n" +
" \"altitude\": 22.0,\n" +
" \"angle\": 7.0,\n" +
" \"index\": 3,\n" +
" \"type\": 1\n" +
" },\n" +
" {\n" +
Reported by PMD.
Line: 31
" },\n" +
" {\n" +
" \"altitude\": 22.0,\n" +
" \"angle\": 7.0,\n" +
" \"index\": 3,\n" +
" \"type\": 1\n" +
" },\n" +
" {\n" +
" \"altitude\": 22.0,\n" +
Reported by PMD.
Line: 39
" \"altitude\": 22.0,\n" +
" \"angle\": 7.0,\n" +
" \"index\": 4,\n" +
" \"type\": 2\n" +
" },\n" +
" {\n" +
" \"altitude\": 22.0,\n" +
" \"angle\": 7.0,\n" +
" \"index\": 5,\n" +
Reported by PMD.
Line: 61
" }\n" +
"]";
JSONValidator validator = JSONValidator.from(str);
Assert.assertTrue(validator.validate());
JSONValidator.Type type = validator.getType();
Assert.assertEquals("Array",type.name());
}
}
Reported by PMD.
Line: 62
"]";
JSONValidator validator = JSONValidator.from(str);
Assert.assertTrue(validator.validate());
JSONValidator.Type type = validator.getType();
Assert.assertEquals("Array",type.name());
}
}
Reported by PMD.
Line: 63
JSONValidator validator = JSONValidator.from(str);
Assert.assertTrue(validator.validate());
JSONValidator.Type type = validator.getType();
Assert.assertEquals("Array",type.name());
}
}
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.