add testcase for issue #685

This commit is contained in:
wenshao
2016-08-28 19:50:25 +08:00
parent 3c0585f3c4
commit d65c5f59e5
@@ -0,0 +1,26 @@
package com.alibaba.json.bvt.bug;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import junit.framework.TestCase;
import java.util.Date;
/**
* Created by wenshao on 16/8/28.
*/
public class Issue685 extends TestCase {
public void test_for_issue() throws Exception {
Model model = new Model();
model.publishTime = new Date();
String text = JSON.toJSONString(model);
Model model2 = JSON.parseObject(text, Model.class);
assertEquals(model.publishTime, model2.publishTime);
}
public static class Model {
@JSONField(format= "yyyy-MM-dd'T'HH:mm:ss.SSS")
public Date publishTime;
}
}