The following issues were found
src/test/java/com/alibaba/json/bvt/bug/Bug_for_42283905_1.java
13 issues
Line: 46
text = JSON.toJSONString(groups);
}
System.out.println(text);
Group[] groups = JSON.parseObject(text, new TypeReference<Group[]>() {
});
Group g0 = groups[0];
Group g1 = groups[1];
Reported by PMD.
Line: 53
Group g0 = groups[0];
Group g1 = groups[1];
System.out.println(JSON.toJSONString(groups));
}
public static class Group {
private String name;
Reported by PMD.
Line: 13
public class Bug_for_42283905_1 extends TestCase {
public void test_0() throws Exception {
String text;
{
List<Group> groups = new ArrayList<Group>();
Reported by PMD.
Line: 13
public class Bug_for_42283905_1 extends TestCase {
public void test_0() throws Exception {
String text;
{
List<Group> groups = new ArrayList<Group>();
Reported by PMD.
Line: 28
{
Group group = new Group("g0");
group.getBattleCommandList().add(c0);
groups.add(group);
}
{
Group group = new Group("g1");
Reported by PMD.
Line: 34
{
Group group = new Group("g1");
group.getBattleCommandList().add(c1);
groups.add(group);
}
{
Group group = new Group("g2");
Reported by PMD.
Line: 40
{
Group group = new Group("g2");
group.getBattleCommandList().add(c2);
groups.add(group);
}
text = JSON.toJSONString(groups);
}
Reported by PMD.
Line: 50
Group[] groups = JSON.parseObject(text, new TypeReference<Group[]>() {
});
Group g0 = groups[0];
Group g1 = groups[1];
System.out.println(JSON.toJSONString(groups));
}
Reported by PMD.
Line: 51
Group[] groups = JSON.parseObject(text, new TypeReference<Group[]>() {
});
Group g0 = groups[0];
Group g1 = groups[1];
System.out.println(JSON.toJSONString(groups));
}
public static class Group {
Reported by PMD.
Line: 56
System.out.println(JSON.toJSONString(groups));
}
public static class Group {
private String name;
private List<Command> battleCommandList = new ArrayList<Command>();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_short_field.java
13 issues
Line: 72
public static class Bean {
public short id;
public String name;
}
}
Reported by PMD.
Line: 16
public class NameFilterTest_short_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (value != null) {
Assert.assertTrue(value instanceof Short);
Reported by PMD.
Line: 24
Assert.assertTrue(value instanceof Short);
}
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 24
Assert.assertTrue(value instanceof Short);
}
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 35
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Bean a = new Bean();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 44
Assert.assertEquals("{\"ID\":0}", text);
}
public void test_namefilter_1() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Short);
Reported by PMD.
Line: 48
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Short);
return "ID";
}
return name;
Reported by PMD.
Line: 48
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Short);
return "ID";
}
return name;
Reported by PMD.
Line: 60
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", (short) 0);
serializer.write(map);
Reported by PMD.
Line: 17
public class NameFilterTest_short_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (value != null) {
Assert.assertTrue(value instanceof Short);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/array/BeanToArrayAutoTypeTest3.java
13 issues
Line: 12
public class BeanToArrayAutoTypeTest3
extends TestCase {
public void test_beanToArray() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\"]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Reported by PMD.
Line: 14
extends TestCase {
public void test_beanToArray() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\"]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
Reported by PMD.
Line: 14
extends TestCase {
public void test_beanToArray() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\"]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
Reported by PMD.
Line: 14
extends TestCase {
public void test_beanToArray() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\"]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
Reported by PMD.
Line: 17
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
Reported by PMD.
Line: 17
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
}
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
Reported by PMD.
Line: 19
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
@JSONType(typeName = "Log")
public static class LogSourceMeta extends MapTaskMeta {
Reported by PMD.
Line: 19
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
@JSONType(typeName = "Log")
public static class LogSourceMeta extends MapTaskMeta {
Reported by PMD.
Line: 19
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
@JSONType(typeName = "Log")
public static class LogSourceMeta extends MapTaskMeta {
Reported by PMD.
Line: 20
public void test_beanToArray1() throws Exception {
Topology topology = JSON.parseObject("{\"maps\":[[\"@type\":\"Log\",123]]}", Topology.class);
assertEquals(LogSourceMeta.class, topology.maps.get(0).getClass());
assertEquals(123, ((LogSourceMeta) topology.maps.get(0)).id);
}
@JSONType(typeName = "Log")
public static class LogSourceMeta extends MapTaskMeta {
public int id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/StrictAutoTypeTest_0.java
13 issues
Line: 10
import junit.framework.TestCase;
public class StrictAutoTypeTest_0 extends TestCase {
private ParserConfig config = new ParserConfig();
public void test_0() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config);
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
Reported by PMD.
Line: 10
import junit.framework.TestCase;
public class StrictAutoTypeTest_0 extends TestCase {
private ParserConfig config = new ParserConfig();
public void test_0() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config);
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
Reported by PMD.
Line: 12
public class StrictAutoTypeTest_0 extends TestCase {
private ParserConfig config = new ParserConfig();
public void test_0() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config);
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 12
public class StrictAutoTypeTest_0 extends TestCase {
private ParserConfig config = new ParserConfig();
public void test_0() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config);
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_1() throws Exception {
Reported by PMD.
Line: 17
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_1() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$VO\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_2() throws Exception {
{
Reported by PMD.
Line: 17
JSON.parseObject("{\"@type\":\"com.alibaba.fastjson.JSONObject\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_1() throws Exception {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$VO\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_2() throws Exception {
{
Reported by PMD.
Line: 21
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$VO\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_2() throws Exception {
{
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$V1\"}", Object.class, config);
} catch (JSONException ex) {
Reported by PMD.
Line: 21
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$VO\"}", Object.class, config, Feature.SupportAutoType);
}
public void test_2() throws Exception {
{
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$V1\"}", Object.class, config);
} catch (JSONException ex) {
Reported by PMD.
Line: 29
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
{
Exception error = null;
try {
JSON.parseObject("{\"@type\":\"com.alibaba.json.bvt.writeClassName.StrictAutoTypeTest_0$V1\"}", Object.class, config);
Reported by PMD.
Line: 38
} catch (JSONException ex) {
error = ex;
}
assertNotNull(error);
}
}
public void test_3() throws Exception {
int features = JSON.DEFAULT_PARSER_FEATURE | Feature.SupportAutoType.mask;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_size.java
13 issues
Line: 17
public class JSONPath_size extends TestCase {
public void test_root() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Reported by PMD.
Line: 19
public void test_root() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Assert.assertEquals(3, JSONPath.size(list, "$"));
}
Reported by PMD.
Line: 20
public void test_root() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Assert.assertEquals(3, JSONPath.size(list, "$"));
}
Reported by PMD.
Line: 26
Assert.assertEquals(3, JSONPath.size(list, "$"));
}
public void test_path() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Reported by PMD.
Line: 38
Assert.assertEquals(3, JSONPath.size(root, "$.values"));
}
public void test_path_size() throws Exception {
JSONPath path = JSONPath.compile("$");
Assert.assertEquals(-1, path.size(null));
}
Reported by PMD.
Line: 41
public void test_path_size() throws Exception {
JSONPath path = JSONPath.compile("$");
Assert.assertEquals(-1, path.size(null));
}
public void test_path_size_1() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
Reported by PMD.
Line: 44
Assert.assertEquals(-1, path.size(null));
}
public void test_path_size_1() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Reported by PMD.
Line: 52
JSONPath path = JSONPath.compile("$");
Assert.assertEquals(3, path.size(list));
}
public void test_path_size_2() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
Reported by PMD.
Line: 55
Assert.assertEquals(3, path.size(list));
}
public void test_path_size_2() throws Exception {
List list = new ArrayList();
list.add(new Entity(101, "kiki"));
list.add(new Entity(102, "ljw2083"));
list.add(new Entity(103, "ljw2083"));
Reported by PMD.
Line: 66
JSONPath path = JSONPath.compile("$.values");
Assert.assertEquals(3, path.size(root));
}
public void test_error() throws Exception {
ErrorSizeBean obj = new ErrorSizeBean();
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeClassName/WriteClassNameTest_Map.java
13 issues
Line: 17
public class WriteClassNameTest_Map extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
Map tables = new LinkedHashMap();
tables.put("1001", new ExtTable(1001));
tables.put("1002", new Table());
model.setTables(tables);
Reported by PMD.
Line: 17
public class WriteClassNameTest_Map extends TestCase {
public void test_list() throws Exception {
Model model = new Model();
Map tables = new LinkedHashMap();
tables.put("1001", new ExtTable(1001));
tables.put("1002", new Table());
model.setTables(tables);
Reported by PMD.
Line: 25
model.setTables(tables);
String json = JSON.toJSONString(model);
assertEquals("{\"tables\":{\"1001\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Map$ExtTable\",\"id\":1001},\"1002\":{}}}", json);
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
Reported by PMD.
Line: 28
assertEquals("{\"tables\":{\"1001\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Map$ExtTable\",\"id\":1001},\"1002\":{}}}", json);
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
Reported by PMD.
Line: 28
assertEquals("{\"tables\":{\"1001\":{\"@type\":\"com.alibaba.json.bvt.writeClassName.WriteClassNameTest_Map$ExtTable\",\"id\":1001},\"1002\":{}}}", json);
JSONObject jsonObject = JSON.parseObject(json, Feature.IgnoreAutoType);
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
Reported by PMD.
Line: 31
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private Map<String, ? extends Table> tables;
Reported by PMD.
Line: 31
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private Map<String, ? extends Table> tables;
Reported by PMD.
Line: 31
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private Map<String, ? extends Table> tables;
Reported by PMD.
Line: 31
assertEquals("{\"tables\":{\"1002\":{},\"1001\":{\"id\":1001}}}", jsonObject.toJSONString());
Model model2 = JSON.parseObject(json, Model.class);
assertEquals(ExtTable.class, model2.getTables().get("1001").getClass());
}
public static class Model {
@JSONField(serialzeFeatures = SerializerFeature.WriteClassName)
private Map<String, ? extends Table> tables;
Reported by PMD.
Line: 52
}
public static class ExtTable extends Table {
public int id;
public ExtTable() {
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_float_field.java
12 issues
Line: 15
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 30
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Bean a = new Bean();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 39
Assert.assertEquals("{\"ID\":0.0}", text);
}
public void test_namefilter_1() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 43
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 43
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 54
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 0);
serializer.write(map);
Reported by PMD.
Line: 16
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
Reported by PMD.
Line: 16
public class NameFilterTest_float_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_min.java
12 issues
Line: 10
import java.math.BigDecimal;
public class JSONPath_min extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_1() throws Exception {
Reported by PMD.
Line: 12
public class JSONPath_min extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
Reported by PMD.
Line: 12
public class JSONPath_min extends TestCase {
public void test_max() throws Exception {
Object root = JSON.parse("[1,3,9, 5, 2, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
Reported by PMD.
Line: 15
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_2() throws Exception {
Reported by PMD.
Line: 17
public void test_max_1() throws Exception {
Object root = JSON.parse("[1,6,7L,3,8,9.1, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
Reported by PMD.
Line: 20
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_3() throws Exception {
Reported by PMD.
Line: 22
public void test_max_2() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1D,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
Reported by PMD.
Line: 25
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_4() throws Exception {
Reported by PMD.
Line: 27
public void test_max_3() throws Exception {
Object root = JSON.parse("[1,6,7L,3,3.1F,8,9.1F, 5, 2L, 4]");
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_4() throws Exception {
Object root = JSON.parse("['1', '111', '2']");
assertEquals("1", JSONPath.eval(root, "$.min()"));
Reported by PMD.
Line: 30
assertEquals(1, JSONPath.eval(root, "$.min()"));
}
public void test_max_4() throws Exception {
Object root = JSON.parse("['1', '111', '2']");
assertEquals("1", JSONPath.eval(root, "$.min()"));
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_int_field.java
12 issues
Line: 15
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
}
return name;
Reported by PMD.
Line: 19
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
}
return name;
Reported by PMD.
Line: 31
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Bean a = new Bean();
serializer.write(a);
String text = out.toString();
Reported by PMD.
Line: 40
Assert.assertEquals("{\"ID\":0}", text);
}
public void test_namefilter_1() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
Reported by PMD.
Line: 44
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 44
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
return "ID";
}
return name;
}
Reported by PMD.
Line: 55
SerializeWriter out = new SerializeWriter();
JSONSerializer serializer = new JSONSerializer(out);
serializer.getNameFilters().add(filter);
Map<String, Object> map = new HashMap<String, Object>();
map.put("id", 0);
serializer.write(map);
Reported by PMD.
Line: 16
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
Reported by PMD.
Line: 16
public class NameFilterTest_int_field extends TestCase {
public void test_namefilter() throws Exception {
NameFilter filter = new NameFilter() {
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Integer);
return "ID";
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue922.java
12 issues
Line: 13
* Created by wenshao on 20/12/2016.
*/
public class Issue922 extends TestCase {
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
Reported by PMD.
Line: 13
* Created by wenshao on 20/12/2016.
*/
public class Issue922 extends TestCase {
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
Reported by PMD.
Line: 16
public void test_for_issue() throws Exception {
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 17
String text = "[1,2,3]";
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 18
JSONArray array = JSON.parseArray(text);
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.
Line: 19
List<Long> list = array.toJavaList(Long.class);
assertEquals(1L, list.get(0).longValue());
assertEquals(2L, list.get(1).longValue());
assertEquals(3L, list.get(2).longValue());
}
}
Reported by PMD.