The following issues were found
src/main/java/com/alibaba/fastjson/serializer/EnumSerializer.java
9 issues
Line: 28
*/
public class EnumSerializer implements ObjectSerializer {
private final Member member;
public EnumSerializer() {
this.member = null;
}
Reported by PMD.
Line: 31
private final Member member;
public EnumSerializer() {
this.member = null;
}
public EnumSerializer(Member member) {
this.member = member;
}
Reported by PMD.
Line: 43
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
if (member == null) {
SerializeWriter out = serializer.out;
out.writeEnum((Enum<?>) object);
return;
}
Object fieldValue = null;
try {
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 54
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
}
serializer.write(fieldValue);
}
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 47
return;
}
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
Reported by PMD.
Line: 50
Object fieldValue = null;
try {
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
Reported by PMD.
Line: 52
if (member instanceof Field) {
fieldValue = ((Field) member).get(object);
} else {
fieldValue = ((Method) member).invoke(object);
}
} catch (Exception e) {
throw new JSONException("getEnumValue error", e);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Bug_for_BlankRain_Issue_502.java
9 issues
Line: 25
String text = JSON.toJSONString(a1);
Assert.assertEquals("{\"姓名\":\"A\",\"时间\":\"F\",\"满意度\":\"D\",\"状态\":\"C\",\"类型\":\"B\",\"统计\":\"E\"}", text);
System.out.println(text);
People a2 = JSON.parseObject(text, People.class);
Assert.assertEquals(a1.get姓名(), a2.get姓名());
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Reported by PMD.
Line: 14
public class Bug_for_BlankRain_Issue_502 extends TestCase {
public void test_for_issue() throws Exception {
People a1 = new People();
a1.set姓名("A");
a1.set类型("B");
a1.set状态("C");
a1.set满意度("D");
Reported by PMD.
Line: 28
System.out.println(text);
People a2 = JSON.parseObject(text, People.class);
Assert.assertEquals(a1.get姓名(), a2.get姓名());
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
Reported by PMD.
Line: 29
People a2 = JSON.parseObject(text, People.class);
Assert.assertEquals(a1.get姓名(), a2.get姓名());
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
}
Reported by PMD.
Line: 30
People a2 = JSON.parseObject(text, People.class);
Assert.assertEquals(a1.get姓名(), a2.get姓名());
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
}
Reported by PMD.
Line: 31
Assert.assertEquals(a1.get姓名(), a2.get姓名());
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
}
public static class People {
Reported by PMD.
Line: 32
Assert.assertEquals(a1.get类型(), a2.get类型());
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
}
public static class People {
Reported by PMD.
Line: 33
Assert.assertEquals(a1.get状态(), a2.get状态());
Assert.assertEquals(a1.get满意度(), a2.get满意度());
Assert.assertEquals(a1.get统计(), a2.get统计());
Assert.assertEquals(a1.get时间(), a2.get时间());
}
public static class People {
private String 姓名;
Reported by PMD.
Line: 36
Assert.assertEquals(a1.get时间(), a2.get时间());
}
public static class People {
private String 姓名;
private String 类型;
private String 状态;
private String 满意度;
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/fastjson/serializer/TestParse.java
9 issues
Line: 15
* Created by yixian on 2016-02-25.
*/
public class TestParse {
private final Logger logger = Logger.getLogger(TestParse.class.getSimpleName());
private String jsonString;
@Before
public void prepareJsonString() {
Reported by PMD.
Line: 31
@Test
public void testParse() {
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
Reported by PMD.
Line: 15
* Created by yixian on 2016-02-25.
*/
public class TestParse {
private final Logger logger = Logger.getLogger(TestParse.class.getSimpleName());
private String jsonString;
@Before
public void prepareJsonString() {
Reported by PMD.
Line: 17
public class TestParse {
private final Logger logger = Logger.getLogger(TestParse.class.getSimpleName());
private String jsonString;
@Before
public void prepareJsonString() {
TestBean bean = new TestBean();
bean.setName("tester");
Reported by PMD.
Line: 30
}
@Test
public void testParse() {
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
Reported by PMD.
Line: 33
public void testParse() {
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
}
Reported by PMD.
Line: 34
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
}
Reported by PMD.
Line: 35
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
}
Reported by PMD.
Line: 35
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
}
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.
src/test/java/com/alibaba/fastjson/serializer/SerializeWriterToBytesTest.java
9 issues
Line: 11
/**
* @author gongdewei 2020/5/15
*/
public class SerializeWriterToBytesTest {
/**
* Execute toBytes periodically, use tools to analyze JVM memory allocation.
* For example, Memory Allocation Record of YourKit java profiler
*/
Reported by PMD.
Line: 17
* Execute toBytes periodically, use tools to analyze JVM memory allocation.
* For example, Memory Allocation Record of YourKit java profiler
*/
public static void testLargeStrToBytes() {
String str = createTestStr();
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
Reported by PMD.
Line: 20
public static void testLargeStrToBytes() {
String str = createTestStr();
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
writer.toBytes("UTF-8");
} finally {
writer.close();
Reported by PMD.
Line: 34
}
}
public static void testLargeStrWriteToEx() throws IOException {
String str = createTestStr();
ByteArrayOutputStream baos = new ByteArrayOutputStream(str.length()+2);
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
Reported by PMD.
Line: 36
public static void testLargeStrWriteToEx() throws IOException {
String str = createTestStr();
ByteArrayOutputStream baos = new ByteArrayOutputStream(str.length()+2);
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
writer.writeToEx(baos, IOUtils.UTF8);
Reported by PMD.
Line: 38
String str = createTestStr();
ByteArrayOutputStream baos = new ByteArrayOutputStream(str.length()+2);
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
writer.writeToEx(baos, IOUtils.UTF8);
} finally {
writer.close();
Reported by PMD.
Line: 18
* For example, Memory Allocation Record of YourKit java profiler
*/
public static void testLargeStrToBytes() {
String str = createTestStr();
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
writer.toBytes("UTF-8");
Reported by PMD.
Line: 36
public static void testLargeStrWriteToEx() throws IOException {
String str = createTestStr();
ByteArrayOutputStream baos = new ByteArrayOutputStream(str.length()+2);
for (int i = 0; i < 600; i++) {
SerializeWriter writer = new SerializeWriter();
try {
writer.writeString(str);
writer.writeToEx(baos, IOUtils.UTF8);
Reported by PMD.
Line: 54
}
private static String createTestStr() {
String tmp = new String(IOUtils.DIGITS);
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 400; i++) {
builder.append(tmp);
}
return builder.toString();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1600/Issue1603_getter.java
9 issues
Line: 11
import java.util.Collections;
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Reported by PMD.
Line: 13
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 13
public class Issue1603_getter extends TestCase {
public void test_emptySet() throws Exception {
Model_1 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_1.class);
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 16
assertEquals(0, m.values.size());
}
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Reported by PMD.
Line: 18
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 18
public void test_emptyList() throws Exception {
Model_2 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_2.class);
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
Reported by PMD.
Line: 21
assertEquals(0, m.values.size());
}
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
Reported by PMD.
Line: 23
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
private final Collection<String> values = Collections.emptySet();
Reported by PMD.
Line: 23
public void test_unmodifier() throws Exception {
Model_3 m = JSON.parseObject("{\"values\":[\"a\"]}", Model_3.class);
assertEquals(0, m.values.size());
}
public static class Model_1 {
private final Collection<String> values = Collections.emptySet();
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/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/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.