コード例 #1
0
 /** Calendar generation when outputing JSON. */
 public void testToJSONCalendar() {
   Date date = new Date(106, 7, 20);
   Calendar cal = Calendar.getInstance();
   cal.setTime(date);
   jsonWriter.object().key("test1").value(cal);
   jsonWriter.endObject();
   assertEquals(jsonWriter.toString(), "{\"test1\":new Date(2006,7,20,0,0)}");
 }
コード例 #2
0
 /** Date generation when outputing JSON. */
 public void testToJSONDate() {
   jsonWriter.object().key("test1").value(new Date(106, 7, 20));
   jsonWriter.endObject();
   assertEquals(jsonWriter.toString(), "{\"test1\":new Date(2006,7,20,0,0)}");
 }