The following issues were found
src/test/java/com/alibaba/json/bvt/parser/deser/TimeDeserializerTest3.java
2 issues
Line: 12
import junit.framework.TestCase;
public class TimeDeserializerTest3 extends TestCase {
public void test_time() throws Exception {
Assert.assertEquals(Time.valueOf("17:00:00"), JSON.parseObject("\"17:00:00\"", Time.class));
}
public void test_time_null() throws Exception {
Assert.assertEquals(null, JSON.parseObject("\"\"", Time.class));
Reported by PMD.
Line: 16
Assert.assertEquals(Time.valueOf("17:00:00"), JSON.parseObject("\"17:00:00\"", Time.class));
}
public void test_time_null() throws Exception {
Assert.assertEquals(null, JSON.parseObject("\"\"", Time.class));
}
public static class VO {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/ShortArraySerializerTest.java
2 issues
Line: 12
public class ShortArraySerializerTest extends TestCase {
public void test_0() {
Assert.assertEquals("[]", JSON.toJSONString(new short[0]));
Assert.assertEquals("[1,2]", JSON.toJSONString(new short[] { 1, 2 }));
Assert.assertEquals("[1,2,3]", JSON.toJSONString(new short[] { 1, 2, 3 }));
}
Reported by PMD.
Line: 8
import org.junit.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeWriter;
public class ShortArraySerializerTest extends TestCase {
public void test_0() {
Assert.assertEquals("[]", JSON.toJSONString(new short[0]));
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/SimpleDataFormatSerializerTest.java
2 issues
Line: 22
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd"));
}
protected void setUp() throws Exception {
JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
JSON.defaultLocale = Locale.CHINA;
}
public void test_0() throws Exception {
Reported by PMD.
Line: 27
JSON.defaultLocale = Locale.CHINA;
}
public void test_0() throws Exception {
Date date = new Date();
String text = JSON.toJSONString(date, mapping);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
format.setTimeZone(JSON.defaultTimeZone);
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd", JSON.defaultLocale);
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/TestInnerClass2.java
2 issues
Line: 11
public class TestInnerClass2 extends TestCase {
public void test_inner() throws Exception {
VO vo = new VO(234);
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"value\":234}", text);
Exception error = null;
Reported by PMD.
Line: 16
String text = JSON.toJSONString(vo);
Assert.assertEquals("{\"value\":234}", text);
Exception error = null;
try {
JSON.parseObject(text, VO.class);
} catch (JSONException ex) {
error = ex;
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/TestSpecial6.java
2 issues
Line: 9
public class TestSpecial6 extends TestCase {
public void test_1() throws Exception {
VO vo = new VO();
vo.setValue("马䶮");
String text = JSON.toJSONString(vo);
Reported by PMD.
Line: 18
VO vo2 = JSON.parseObject(text, VO.class);
Assert.assertEquals(vo.value, vo2.value);
assertEquals("{\"value\":\"马䶮\"}", text);
}
public static class VO {
private String value;
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/SmartMatchTest_snake2.java
2 issues
Line: 12
public class SmartMatchTest_snake2 extends TestCase {
public void test_0() throws Exception {
String text = "{\"_id\":1001}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(1001, vo.id);
}
Reported by PMD.
Line: 20
}
public static class VO {
public int id;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/WriteSlashAsSpecialTest.java
2 issues
Line: 13
import junit.framework.TestCase;
public class WriteSlashAsSpecialTest extends TestCase {
public void test_0 () throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("value", "/");
String result = JSON.toJSONString(map);
Assert.assertEquals("{\"value\":\"/\"}", result);
}
Reported by PMD.
Line: 20
Assert.assertEquals("{\"value\":\"/\"}", result);
}
public void test_1 () throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
map.put("value", "/");
String result = JSON.toJSONString(map, SerializerFeature.WriteSlashAsSpecial);
Assert.assertEquals("{\"value\":\"\\/\"}", result);
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/SmartMatchTest_snake.java
2 issues
Line: 12
public class SmartMatchTest_snake extends TestCase {
public void test_0() throws Exception {
String text = "{\"person_id\":1001}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(1001, vo.personId);
}
Reported by PMD.
Line: 20
}
public static class VO {
public int personId;
}
}
Reported by PMD.
src/test/java/com/alibaba/json/bvt/serializer/date/DateTest3.java
2 issues
Line: 13
public class DateTest3 extends TestCase {
public void test_date() throws Exception {
String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.25+07:00\"}";
Date date = JSON.parseObject(text, VO.class).getGmtCreate();
Assert.assertNotNull(date);
}
Reported by PMD.
Line: 16
public void test_date() throws Exception {
String text = "{\"gmtCreate\":\"2014-08-21T09:51:36.25+07:00\"}";
Date date = JSON.parseObject(text, VO.class).getGmtCreate();
Assert.assertNotNull(date);
}
public static class VO {
Reported by PMD.
src/test/java/com/alibaba/json/bvt/parser/deser/SmartMatchTest_boolean_is.java
2 issues
Line: 12
public class SmartMatchTest_boolean_is extends TestCase {
public void test_0() throws Exception {
String text = "{\"isVisible\":true}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(true, vo.isVisible());
}
Reported by PMD.
Line: 16
String text = "{\"isVisible\":true}";
VO vo = JSON.parseObject(text, VO.class);
Assert.assertEquals(true, vo.isVisible());
}
public static class VO {
private boolean visible;
Reported by PMD.