package com.alibaba.json.bvt.date;

import java.util.Calendar;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.fastjson.JSON;

public class CalendarTest extends TestCase {

    public void test_0() throws Exception {
        String text = "{\"calendar\":null}";
        
        VO vo = JSON.parseObject(text, VO.class);
        Assert.assertNull(vo.getCalendar());
    }

    public static class VO {

        private Calendar calendar;

        public Calendar getCalendar() {
            return calendar;
        }

        public void setCalendar(Calendar calendar) {
            this.calendar = calendar;
        }

    }
}

@@ -150,16 +150,74 @@
 on.JSON;
+%0Aimport com.alibaba.fastjson.serializer.SerializerFeature;
 %0A%0Apublic
@@ -281,9 +281,12 @@
 est_
-0
+null
 () t
@@ -453,24 +453,1467 @@
 ar());%0A    %7D
+%0A    %0A    public void test_codec() throws Exception %7B%0A        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);%0A        VO vo = new VO();%0A        vo.setCalendar(calendar);%0A        String text = JSON.toJSONString(vo);%0A        %0A        VO vo2 = JSON.parseObject(text, VO.class);%0A        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());%0A    %7D%0A    %0A    public void test_codec_iso88591() throws Exception %7B%0A        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);%0A        VO vo = new VO();%0A        vo.setCalendar(calendar);%0A        String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);%0A        %0A        VO vo2 = JSON.parseObject(text, VO.class);%0A        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());%0A    %7D%0A    %0A    public void test_codec_iso88591_2() throws Exception %7B%0A        Calendar calendar = Calendar.getInstance(JSON.defaultTimeZone, JSON.defaultLocale);%0A        calendar.set(Calendar.SECOND, 0);%0A        calendar.set(Calendar.MILLISECOND, 0);%0A        VO vo = new VO();%0A        vo.setCalendar(calendar);%0A        String text = JSON.toJSONString(vo, SerializerFeature.UseISO8601DateFormat);%0A        %0A        VO vo2 = JSON.parseObject(text, VO.class);%0A        Assert.assertEquals(vo.getCalendar().getTimeInMillis(), vo2.getCalendar().getTimeInMillis());%0A    %7D
 %0A%0A    public

add testcase for Calendar