Example #1
0
 public void testToDateString() {
   Date d = Utils.toDate("2010/07/11");
   Calendar c = Calendar.getInstance();
   c.setTime(d);
   assertEquals(2010, c.get(Calendar.YEAR));
   assertEquals(7 - 1, c.get(Calendar.MONTH));
   assertEquals(11, c.get(Calendar.DAY_OF_MONTH));
 }
Example #2
0
 public void testToDateObject() {
   Object arg = "2010/07/11";
   Date d = Utils.toDate(arg);
   Calendar c = Calendar.getInstance();
   c.setTime(d);
   assertEquals(2010, c.get(Calendar.YEAR));
   assertEquals(7 - 1, c.get(Calendar.MONTH));
   assertEquals(11, c.get(Calendar.DAY_OF_MONTH));
 }