The following issues were found
src/test/java/com/alibaba/json/bvt/basicType/LongNullTest_primitive.java
17 issues
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class LongNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class LongNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 12
public class LongNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Reported by PMD.
Line: 13
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
Reported by PMD.
Line: 14
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
Reported by PMD.
Line: 17
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 17
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 19
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Reported by PMD.
Line: 20
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
Reported by PMD.
Line: 21
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
assertNotNull(model);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/issue_1700/issue1763_2/TestIssue1763_2.java
17 issues
Line: 18
* @author cnlyml
*/
public class TestIssue1763_2<T> {
private String jsonStr;
private Class<T> clazz;
@Before
public void init() {
jsonStr = "{\"code\":0, \"message\":\"Success\", \"content\":{\"pageNum\":1, \"pageSize\":2, \"size\":2, \"startRow\":1, \"endRow\":1, \"total\":2, \"pages\":1, \"list\":[{\"id\":10000001, \"couponName\":\"Test1\"}, {\"id\":10000002, \"couponName\": \"Test2\"}]}}";
Reported by PMD.
Line: 19
*/
public class TestIssue1763_2<T> {
private String jsonStr;
private Class<T> clazz;
@Before
public void init() {
jsonStr = "{\"code\":0, \"message\":\"Success\", \"content\":{\"pageNum\":1, \"pageSize\":2, \"size\":2, \"startRow\":1, \"endRow\":1, \"total\":2, \"pages\":1, \"list\":[{\"id\":10000001, \"couponName\":\"Test1\"}, {\"id\":10000002, \"couponName\": \"Test2\"}]}}";
clazz = (Class<T>) CouponResult.class;
Reported by PMD.
Line: 33
BaseResult<PageResult<CouponResult>> data = JSON.parseObject(jsonStr, new TypeReference<BaseResult<PageResult<T>>>(clazz){}.getType());
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
Reported by PMD.
Line: 33
BaseResult<PageResult<CouponResult>> data = JSON.parseObject(jsonStr, new TypeReference<BaseResult<PageResult<T>>>(clazz){}.getType());
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
Reported by PMD.
Line: 34
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
Reported by PMD.
Line: 34
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
Reported by PMD.
Line: 34
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
Reported by PMD.
Line: 34
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
Reported by PMD.
Line: 35
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
public void testBug1763_2() {
Reported by PMD.
Line: 35
Assert.assertTrue(data.isSuccess());
Assert.assertTrue(data.getContent().getList().size() == 2);
Assert.assertTrue(data.getContent().getList().get(0).getId().equals(10000001L));
Assert.assertEquals(CouponResult.class, data.getContent().getList().get(0).getClass());
}
// 复现BUG
@Test
public void testBug1763_2() {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/basicType/IntNullTest_primitive.java
17 issues
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class IntNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class IntNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 12
public class IntNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Reported by PMD.
Line: 13
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
Reported by PMD.
Line: 14
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0, model.v1);
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
Reported by PMD.
Line: 17
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 17
assertEquals(0,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
Reported by PMD.
Line: 19
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Reported by PMD.
Line: 20
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
Reported by PMD.
Line: 21
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0,model.v1);
assertEquals(0,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
assertNotNull(model);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/path/JSONPath_calenar_test.java
17 issues
Line: 12
import java.util.Map;
public class JSONPath_calenar_test extends TestCase {
public void test_map() throws Exception {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2017);
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
Reported by PMD.
Line: 12
import java.util.Map;
public class JSONPath_calenar_test extends TestCase {
public void test_map() throws Exception {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2017);
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
Reported by PMD.
Line: 14
public class JSONPath_calenar_test extends TestCase {
public void test_map() throws Exception {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2017);
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
Reported by PMD.
Line: 15
public void test_map() throws Exception {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2017);
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
Reported by PMD.
Line: 16
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.YEAR, 2017);
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
Reported by PMD.
Line: 18
calendar.set(Calendar.MONTH, 6);
calendar.set(Calendar.DAY_OF_MONTH, 30);
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
assertEquals(2017, JSONPath.eval(calendar, "/year"));
assertEquals(6, JSONPath.eval(calendar, "/month"));
Reported by PMD.
Line: 19
calendar.set(Calendar.DAY_OF_MONTH, 30);
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
assertEquals(2017, JSONPath.eval(calendar, "/year"));
assertEquals(6, JSONPath.eval(calendar, "/month"));
assertEquals(30, JSONPath.eval(calendar, "/day"));
Reported by PMD.
Line: 20
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
assertEquals(2017, JSONPath.eval(calendar, "/year"));
assertEquals(6, JSONPath.eval(calendar, "/month"));
assertEquals(30, JSONPath.eval(calendar, "/day"));
Reported by PMD.
Line: 22
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 43);
assertEquals(2017, JSONPath.eval(calendar, "/year"));
assertEquals(6, JSONPath.eval(calendar, "/month"));
assertEquals(30, JSONPath.eval(calendar, "/day"));
assertEquals(16, JSONPath.eval(calendar, "/hour"));
assertEquals(8, JSONPath.eval(calendar, "/minute"));
Reported by PMD.
Line: 23
calendar.set(Calendar.SECOND, 43);
assertEquals(2017, JSONPath.eval(calendar, "/year"));
assertEquals(6, JSONPath.eval(calendar, "/month"));
assertEquals(30, JSONPath.eval(calendar, "/day"));
assertEquals(16, JSONPath.eval(calendar, "/hour"));
assertEquals(8, JSONPath.eval(calendar, "/minute"));
assertEquals(43, JSONPath.eval(calendar, "/second"));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/writeAsArray/WriteAsArray_list_obj_public.java
17 issues
Line: 16
public class WriteAsArray_list_obj_public extends TestCase {
public void test_0() throws Exception {
VO vo = new VO();
vo.setId(123);
vo.setName("wenshao");
vo.getValues().add(new A());
Reported by PMD.
Line: 26
Assert.assertEquals("[123,\"wenshao\",[[0]]]", text);
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
Reported by PMD.
Line: 27
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
Reported by PMD.
Line: 28
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 28
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 28
VO vo2 = JSON.parseObject(text, VO.class, Feature.SupportArrayToBean);
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 29
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 29
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 29
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
Line: 29
Assert.assertEquals(vo.getId(), vo2.getId());
Assert.assertEquals(vo.getName(), vo2.getName());
Assert.assertEquals(vo.getValues().size(), vo2.getValues().size());
Assert.assertEquals(vo.getValues().get(0).getClass(), vo2.getValues().get(0).getClass());
Assert.assertEquals(vo.getValues().get(0).getValue(), vo2.getValues().get(0).getValue());
}
public static class VO {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/bug/Issue955.java
17 issues
Line: 23
*/
public class Issue955 extends TestCase {
public void test_checkObject() {
Art origin = makeOrigin();
JSONObject articleObj = (JSONObject) JSON.toJSON(origin);
JSONObject dataObj = new JSONObject();
dataObj.put("art", articleObj);
Reported by PMD.
Line: 31
dataObj.put("art", articleObj);
Art other = dataObj.getObject("art", Art.class);// return null;
assertSame(origin, other); // test failed
}
public void test_checkArray() throws Exception {
Art origin = makeOrigin();
JSONObject object = (JSONObject) JSON.toJSON(origin);
Reported by PMD.
Line: 34
assertSame(origin, other); // test failed
}
public void test_checkArray() throws Exception {
Art origin = makeOrigin();
JSONObject object = (JSONObject) JSON.toJSON(origin);
JSONArray jsonArray = new JSONArray();
jsonArray.add(object);
Reported by PMD.
Line: 34
assertSame(origin, other); // test failed
}
public void test_checkArray() throws Exception {
Art origin = makeOrigin();
JSONObject object = (JSONObject) JSON.toJSON(origin);
JSONArray jsonArray = new JSONArray();
jsonArray.add(object);
Reported by PMD.
Line: 42
jsonArray.add(object);
Art other = JSON.parseObject(jsonArray.getString(0), Art.class);
assertSame(origin, other); // test passed
other = jsonArray.getObject(0, Art.class); // return = null;
assertSame(origin, other); // test failed
}
Reported by PMD.
Line: 45
assertSame(origin, other); // test passed
other = jsonArray.getObject(0, Art.class); // return = null;
assertSame(origin, other); // test failed
}
private Art makeOrigin() {
final long unixTime = System.currentTimeMillis() / 1000;
final Art origin = new Art();
Reported by PMD.
Line: 58
}
public void assertSame(Art origin, Art another) {
assertNotNull(another);
assertEquals(origin.id, another.id);
assertEquals(origin.date, another.date);
assertSame(origin.isSupported, another.isSupported);
}
Reported by PMD.
Line: 59
public void assertSame(Art origin, Art another) {
assertNotNull(another);
assertEquals(origin.id, another.id);
assertEquals(origin.date, another.date);
assertSame(origin.isSupported, another.isSupported);
}
@JSONType(builder = Art.Builder.class)
Reported by PMD.
Line: 60
public void assertSame(Art origin, Art another) {
assertNotNull(another);
assertEquals(origin.id, another.id);
assertEquals(origin.date, another.date);
assertSame(origin.isSupported, another.isSupported);
}
@JSONType(builder = Art.Builder.class)
public static class Art {
Reported by PMD.
Line: 61
assertNotNull(another);
assertEquals(origin.id, another.id);
assertEquals(origin.date, another.date);
assertSame(origin.isSupported, another.isSupported);
}
@JSONType(builder = Art.Builder.class)
public static class Art {
private String id;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/LongFieldDeserializerTest3.java
17 issues
Line: 13
public class LongFieldDeserializerTest3 extends TestCase {
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123L, a.getF1());
Assert.assertEquals(null, a.getF2());
}
Reported by PMD.
Line: 15
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123L, a.getF1());
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Reported by PMD.
Line: 16
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123L, a.getF1());
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Reported by PMD.
Line: 19
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
Reported by PMD.
Line: 21
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Reported by PMD.
Line: 22
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Reported by PMD.
Line: 22
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Reported by PMD.
Line: 25
Assert.assertEquals(33L, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
Reported by PMD.
Line: 27
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
public static class Entity {
Reported by PMD.
Line: 28
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22L, a.getF1());
Assert.assertEquals(33L, a.getF2().intValue());
}
public static class Entity {
private long f1 = 124;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/basicType/FloatNullTest_primitive.java
17 issues
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class FloatNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0F, model.v1);
assertEquals(0F,model.v2);
}
Reported by PMD.
Line: 10
* Created by wenshao on 10/08/2017.
*/
public class FloatNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0F, model.v1);
assertEquals(0F,model.v2);
}
Reported by PMD.
Line: 12
public class FloatNullTest_primitive extends TestCase {
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0F, model.v1);
assertEquals(0F,model.v2);
}
public void test_null_1() throws Exception {
Reported by PMD.
Line: 13
public void test_null() throws Exception {
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0F, model.v1);
assertEquals(0F,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
Reported by PMD.
Line: 14
Model model = JSON.parseObject("{\"v1\":null,\"v2\":null}", Model.class);
assertNotNull(model);
assertEquals(0F, model.v1);
assertEquals(0F,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
Reported by PMD.
Line: 17
assertEquals(0F,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0F,model.v1);
assertEquals(0F,model.v2);
}
Reported by PMD.
Line: 17
assertEquals(0F,model.v2);
}
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0F,model.v1);
assertEquals(0F,model.v2);
}
Reported by PMD.
Line: 19
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0F,model.v1);
assertEquals(0F,model.v2);
}
public void test_null_2() throws Exception {
Reported by PMD.
Line: 20
public void test_null_1() throws Exception {
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0F,model.v1);
assertEquals(0F,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
Reported by PMD.
Line: 21
Model model = JSON.parseObject("{\"v1\":null ,\"v2\":null }", Model.class);
assertNotNull(model);
assertEquals(0F,model.v1);
assertEquals(0F,model.v2);
}
public void test_null_2() throws Exception {
Model model = JSON.parseObject("{\"v1\":\"null\",\"v2\":\"null\" }", Model.class);
assertNotNull(model);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/IntegerFieldDeserializerTest3.java
17 issues
Line: 13
public class IntegerFieldDeserializerTest3 extends TestCase {
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123, a.getF1());
Assert.assertEquals(null, a.getF2());
}
Reported by PMD.
Line: 15
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123, a.getF1());
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Reported by PMD.
Line: 16
public void test_0() throws Exception {
Entity a = JSON.parseObject("{f1:123, f2:null}", Entity.class);
Assert.assertEquals(123, a.getF1());
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22, a.getF1());
Reported by PMD.
Line: 19
Assert.assertEquals(null, a.getF2());
}
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
Reported by PMD.
Line: 21
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Reported by PMD.
Line: 22
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22, a.getF1());
Reported by PMD.
Line: 22
public void test_1() throws Exception {
Entity a = JSON.parseObject("{f1:22, f2:'33'}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22, a.getF1());
Reported by PMD.
Line: 25
Assert.assertEquals(33, a.getF2().intValue());
}
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
Reported by PMD.
Line: 27
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
public static class Entity {
Reported by PMD.
Line: 28
public void test_2() throws Exception {
Entity a = JSON.parseObject("{f1:'22', f2:33}", Entity.class);
Assert.assertEquals(22, a.getF1());
Assert.assertEquals(33, a.getF2().intValue());
}
public static class Entity {
private int f1 = 124;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/DefaultExtJSONParserTest_3.java
17 issues
Line: 15
public class DefaultExtJSONParserTest_3 extends TestCase {
public void test_0() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v1:3}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
}
Reported by PMD.
Line: 19
DefaultJSONParser parser = new DefaultJSONParser("{v1:3}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
}
public void test_1() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v1:'3'}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Reported by PMD.
Line: 22
Assert.assertEquals(3, a.getV1());
}
public void test_1() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v1:'3'}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
Reported by PMD.
Line: 27
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
}
public void test_2() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v1:\"3\"}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Reported by PMD.
Line: 30
Assert.assertEquals(3, a.getV1());
}
public void test_2() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v1:\"3\"}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
Reported by PMD.
Line: 35
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3, a.getV1());
}
public void test_3() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{o1:{}}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Reported by PMD.
Line: 38
Assert.assertEquals(3, a.getV1());
}
public void test_3() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{o1:{}}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(true, a.getO1() != null);
Reported by PMD.
Line: 43
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(true, a.getO1() != null);
}
public void test_4() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v5:'3'}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Reported by PMD.
Line: 46
Assert.assertEquals(true, a.getO1() != null);
}
public void test_4() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v5:'3'}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3L, a.getV5().longValue());
Reported by PMD.
Line: 51
parser.config(Feature.AllowUnQuotedFieldNames, true);
parser.config(Feature.AllowSingleQuotes, true);
A a = parser.parseObject(A.class);
Assert.assertEquals(3L, a.getV5().longValue());
}
public void test_5() throws Exception {
DefaultJSONParser parser = new DefaultJSONParser("{v5:\"3\"}");
parser.config(Feature.AllowUnQuotedFieldNames, true);
Reported by PMD.