The following issues were found
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_long.java
13 issues
Line: 15
public class NameFilterTest_long 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 Long);
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 Long);
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 Long);
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: 65
Assert.assertEquals("{\"ID\":0}", text);
}
public static class Bean {
private long id;
private String name;
public long getId() {
Reported by PMD.
Line: 16
public class NameFilterTest_long 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 Long);
return "ID";
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/EnumerationSeriliazerTest.java
13 issues
Line: 15
public class EnumerationSeriliazerTest extends TestCase {
public void test_nullAsEmtpyList() throws Exception {
VO e = new VO();
Assert.assertEquals("{\"elements\":[]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullListAsEmpty));
}
Reported by PMD.
Line: 21
SerializerFeature.WriteNullListAsEmpty));
}
public void test_null() throws Exception {
VO e = new VO();
Assert.assertEquals("{\"elements\":null}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
}
public void test_1() throws Exception {
Reported by PMD.
Line: 26
Assert.assertEquals("{\"elements\":null}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
}
public void test_1() throws Exception {
VO e = new VO(new Entity(), new Entity());
Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
}
public void test_2() throws Exception {
Reported by PMD.
Line: 31
Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteMapNullValue));
}
public void test_2() throws Exception {
VO e = new VO(new Entity(), new Entity2());
Assert.assertEquals("{\"elements\":[{},{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity2\"}]}",
JSON.toJSONString(e, SerializerFeature.WriteClassName,
SerializerFeature.NotWriteRootClassName));
}
Reported by PMD.
Line: 38
SerializerFeature.NotWriteRootClassName));
}
public void test_3() throws Exception {
VO2 e = new VO2(new Entity(), new Entity());
Assert.assertEquals("{\"elements\":[{},{}]}", JSON.toJSONString(e, SerializerFeature.WriteClassName,
SerializerFeature.NotWriteRootClassName));
}
Reported by PMD.
Line: 44
SerializerFeature.NotWriteRootClassName));
}
public void test_4() throws Exception {
VO3 e = new VO3(new Entity(), new Entity2());
Assert.assertEquals("{\"elements\":[{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity\"},{\"@type\":\"com.alibaba.json.bvt.serializer.EnumerationSeriliazerTest$Entity2\"}]}", JSON.toJSONString(e, SerializerFeature.WriteClassName,
SerializerFeature.NotWriteRootClassName));
}
Reported by PMD.
Line: 56
public VO(Entity... array){
if (array.length > 0) {
Vector<Entity> vector = new Vector<Entity>();
for (Entity item : array) {
vector.add(item);
}
this.elements = vector.elements();
}
Reported by PMD.
Line: 56
public VO(Entity... array){
if (array.length > 0) {
Vector<Entity> vector = new Vector<Entity>();
for (Entity item : array) {
vector.add(item);
}
this.elements = vector.elements();
}
Reported by PMD.
Line: 78
public VO2(Entity... array){
if (array.length > 0) {
Vector<Entity> vector = new Vector<Entity>();
for (Entity item : array) {
vector.add(item);
}
this.elements = vector.elements();
}
Reported by PMD.
Line: 78
public VO2(Entity... array){
if (array.length > 0) {
Vector<Entity> vector = new Vector<Entity>();
for (Entity item : array) {
vector.add(item);
}
this.elements = vector.elements();
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_double.java
13 issues
Line: 15
public class NameFilterTest_double 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: 64
Assert.assertEquals("{\"ID\":0}", text);
}
public static class Bean {
private double id;
private String name;
public double getId() {
Reported by PMD.
Line: 16
public class NameFilterTest_double 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/fastjson/validate/JSONValidateTest_0.java
13 issues
Line: 20
JSONValidator validator = JSONValidator.from(json);
validator.validate(); // 518
}
System.out.println("millis : " + (System.currentTimeMillis() - start));
}
}
Reported by PMD.
Line: 36
JSONValidator validator = JSONValidator.fromUtf8(json);
validator.validate();
}
System.out.println("millis : " + (System.currentTimeMillis() - start));
}
}
}
Reported by PMD.
Line: 11
import java.io.ByteArrayInputStream;
public class JSONValidateTest_0 extends TestCase {
public void test_validate_benchmark() throws Exception {
String json = JSON.toJSONString(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 10; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
Reported by PMD.
Line: 11
import java.io.ByteArrayInputStream;
public class JSONValidateTest_0 extends TestCase {
public void test_validate_benchmark() throws Exception {
String json = JSON.toJSONString(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 10; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
Reported by PMD.
Line: 12
public class JSONValidateTest_0 extends TestCase {
public void test_validate_benchmark() throws Exception {
String json = JSON.toJSONString(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 10; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
JSONValidator validator = JSONValidator.from(json);
Reported by PMD.
Line: 18
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
JSONValidator validator = JSONValidator.from(json);
validator.validate(); // 518
}
System.out.println("millis : " + (System.currentTimeMillis() - start));
}
}
Reported by PMD.
Line: 27
public void test_validate_utf8_benchmark() throws Exception {
byte[] json = JSON.toJSONBytes(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 5; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
Reported by PMD.
Line: 27
public void test_validate_utf8_benchmark() throws Exception {
byte[] json = JSON.toJSONBytes(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 5; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
Reported by PMD.
Line: 28
public void test_validate_utf8_benchmark() throws Exception {
byte[] json = JSON.toJSONBytes(EishayDecodeBytes.instance.getContent());
for (int n = 0; n < 5; ++n) {
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
JSONValidator validator = JSONValidator.fromUtf8(json);
Reported by PMD.
Line: 34
long start = System.currentTimeMillis();
for (int i = 0; i < 1000 * 1000 * 1; ++i) {
JSONValidator validator = JSONValidator.fromUtf8(json);
validator.validate();
}
System.out.println("millis : " + (System.currentTimeMillis() - start));
}
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_char.java
13 issues
Line: 15
public class NameFilterTest_char 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")) {
Reported by PMD.
Line: 20
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Character);
return "ID";
}
return name;
Reported by PMD.
Line: 20
public String process(Object source, String name, Object value) {
if (name.equals("id")) {
Assert.assertTrue(value instanceof Character);
return "ID";
}
return name;
Reported by PMD.
Line: 32
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: 41
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: 45
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: 45
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: 56
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: 66
Assert.assertEquals("{\"ID\":\"0\"}", text);
}
public static class Bean {
private char id = '0';
private String name;
public char getId() {
Reported by PMD.
Line: 16
public class NameFilterTest_char 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 Character);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/filters/NameFilterTest_float.java
13 issues
Line: 15
public class NameFilterTest_float 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: 64
Assert.assertEquals("{\"ID\":0}", text);
}
public static class Bean {
private float id;
private String name;
public float getId() {
Reported by PMD.
Line: 16
public class NameFilterTest_float 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/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/bug/Bug_for_42283905.java
13 issues
Line: 46
text = JSON.toJSONString(groups);
}
System.out.println(text);
List<Group> groups = JSON.parseObject(text, new TypeReference<List<Group>>() {
});
Group g0 = groups.get(0);
Group g1 = groups.get(1);
Reported by PMD.
Line: 53
Group g0 = groups.get(0);
Group g1 = groups.get(1);
System.out.println(JSON.toJSONString(groups));
}
public static class Group {
private String name;
Reported by PMD.
Line: 13
public class Bug_for_42283905 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 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
List<Group> groups = JSON.parseObject(text, new TypeReference<List<Group>>() {
});
Group g0 = groups.get(0);
Group g1 = groups.get(1);
System.out.println(JSON.toJSONString(groups));
}
Reported by PMD.
Line: 51
List<Group> groups = JSON.parseObject(text, new TypeReference<List<Group>>() {
});
Group g0 = groups.get(0);
Group g1 = groups.get(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/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.