The following issues were found
src/test/java/com/alibaba/json/bvt/issue_1700/Issue1785.java
2 issues
Line: 7
import junit.framework.TestCase;
public class Issue1785 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("\"2006-8-9\"", java.sql.Timestamp.class);
}
}
Reported by PMD.
Line: 7
import junit.framework.TestCase;
public class Issue1785 extends TestCase {
public void test_for_issue() throws Exception {
JSON.parseObject("\"2006-8-9\"", java.sql.Timestamp.class);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/LocalDateTimeTest4.java
2 issues
Line: 13
public class LocalDateTimeTest4 extends TestCase {
public void test_for_issue() throws Exception {
LocalDateTime dateTime = LocalDateTime.of(2016, 5, 6, 9, 3, 16);
VO vo = new VO();
vo.setDate(dateTime);
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 23
VO vo1 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.getDate(), vo1.getDate());
}
public static class VO {
private LocalDateTime date;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2000/Issue2066.java
2 issues
Line: 11
public class Issue2066 extends TestCase {
public void test_issue() throws Exception {
JSON.parseObject("{\"values\":[[1,2],[3,4]]}", Model.class);
}
public static class Model {
private List<float[]> values;
Reported by PMD.
Line: 11
public class Issue2066 extends TestCase {
public void test_issue() throws Exception {
JSON.parseObject("{\"values\":[[1,2],[3,4]]}", Model.class);
}
public static class Model {
private List<float[]> values;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2000/Issue2074.java
2 issues
Line: 8
import junit.framework.TestCase;
public class Issue2074 extends TestCase {
public void test_for_issue() throws Exception {
JSONObject object = new JSONObject();
object.put("name", null);
assertEquals("{\"name\":null}"
, object.toString(SerializerFeature.WriteMapNullValue));
Reported by PMD.
Line: 12
JSONObject object = new JSONObject();
object.put("name", null);
assertEquals("{\"name\":null}"
, object.toString(SerializerFeature.WriteMapNullValue));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/JSONScannerTest_scanFieldBoolean_unquote.java
2 issues
Line: 11
public class JSONScannerTest_scanFieldBoolean_unquote extends TestCase {
public void test_4() throws Exception {
String text = "{\"value\":false,id:2}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertEquals(false, obj.getValue());
}
}
Reported by PMD.
Line: 14
public void test_4() throws Exception {
String text = "{\"value\":false,id:2}";
VO obj = JSON.parseObject(text, VO.class);
Assert.assertEquals(false, obj.getValue());
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/OptionalInt_Test.java
2 issues
Line: 13
public class OptionalInt_Test extends TestCase {
public void test_optional() throws Exception {
Model model = new Model();
model.value = OptionalInt.empty();
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 28
public static class Model {
public OptionalInt value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_3300/Issue3326.java
2 issues
Line: 10
import java.util.HashMap;
public class Issue3326 extends TestCase {
public void test_for_issue() throws Exception {
HashMap<String, Number> map = JSON.parseObject("{\"id\":10.0}"
, new TypeReference<HashMap<String, Number>>() {
}.getType()
, 0);
assertEquals(10.0, map.get("id"));
Reported by PMD.
Line: 15
, new TypeReference<HashMap<String, Number>>() {
}.getType()
, 0);
assertEquals(10.0, map.get("id"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/jdk8/OptionalDouble_Test.java
2 issues
Line: 13
public class OptionalDouble_Test extends TestCase {
public void test_optional() throws Exception {
Model model = new Model();
model.value = OptionalDouble.empty();
String text = JSON.toJSONString(model);
Reported by PMD.
Line: 28
public static class Model {
public OptionalDouble value;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/guava/MultiMapTes.java
2 issues
Line: 14
*/
public class MultiMapTes extends TestCase {
public void test_multimap() throws Exception {
Map<String, Integer> map = ImmutableMap.of("a", 1, "b", 1, "c", 2);
SetMultimap<String, Integer> multimap = Multimaps.forMap(map);
Multimap<Integer, String> inverse = Multimaps.invertFrom(multimap, HashMultimap.<Integer, String>create());
String json = JSON.toJSONString(inverse);
assertEquals("{1:[\"a\",\"b\"],2:[\"c\"]}",json);
Reported by PMD.
Line: 19
SetMultimap<String, Integer> multimap = Multimaps.forMap(map);
Multimap<Integer, String> inverse = Multimaps.invertFrom(multimap, HashMultimap.<Integer, String>create());
String json = JSON.toJSONString(inverse);
assertEquals("{1:[\"a\",\"b\"],2:[\"c\"]}",json);
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_2700/Issue2792.java
2 issues
Line: 9
import junit.framework.TestCase;
public class Issue2792 extends TestCase {
public void test_for_issue() throws Exception {
String jsonpath = "$.sku[?((@.quantity != 0)&&(@.is_onsale == 1))].sku_id";
JSONObject root = JSON.parseObject("{\"sku\":{\"quantity\":12,\"is_onsale\":1,\"sku_id\":42356}}");
assertEquals(42356, JSONPath.eval(root, jsonpath));
Reported by PMD.
Line: 14
JSONObject root = JSON.parseObject("{\"sku\":{\"quantity\":12,\"is_onsale\":1,\"sku_id\":42356}}");
assertEquals(42356, JSONPath.eval(root, jsonpath));
}
}
Reported by PMD.