package com.alibaba.json.bvt.bug;

import java.text.SimpleDateFormat;
import java.util.Date;

import junit.framework.Assert;
import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

public class Bug_for_80108116 extends TestCase {

    public void test_for_dateFormat() throws Exception {
        VO vo = new VO();
        vo.setDate(new SimpleDateFormat("yyyy-MM-dd").parse("2012-07-12"));
        String text = JSON.toJSONString(vo);
        Assert.assertEquals("{\"date\":\"2012-07-12\"}", text);
    }

    public static class VO {

        @JSONField(format = "yyyy-MM-dd")
        private Date date;

        public Date getDate() {
            return date;
        }

        public void setDate(Date date) {
            this.date = date;
        }
    }
}

@@ -80,20 +80,71 @@
 va.util.
-Date
+ArrayList;%0Aimport java.util.Date;%0Aimport java.util.List
 ;%0A%0Aimpor
@@ -497,16 +497,89 @@
 -12%22));%0A
+%0A        List%3CVO%3E voList = new ArrayList%3CVO%3E();%0A        voList.add(vo);%0A%0A
         
@@ -612,16 +612,20 @@
 tring(vo
+List
 );%0A     
@@ -648,16 +648,17 @@
 Equals(%22
+%5B
 %7B%5C%22date%5C
@@ -674,16 +674,17 @@
 07-12%5C%22%7D
+%5D
 %22, text)
@@ -718,24 +718,52 @@
 class VO %7B%0A%0A
+        private Date date;%0A%0A
         @JSO
@@ -796,36 +796,8 @@
 d%22)%0A
-        private Date date;%0A%0A
     
@@ -947,10 +947,11 @@
 %7D%0A    %7D%0A
+%0A
 %7D%0A

add testcase