예제 #1
0
 public void testToStringDate() {
   Calendar c = Calendar.getInstance();
   c.set(2009, 6 - 1, 23);
   Date d = c.getTime();
   String s = Utils.toString(d);
   assertEquals("2009/06/23", s);
 }
예제 #2
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));
 }
예제 #3
0
 public void testToCalendar() {
   Calendar c = Calendar.getInstance();
   c.set(2005, 11 - 1, 1);
   Date d = c.getTime();
   Calendar actual = Utils.toCalendar(d);
   assertEquals(2005, actual.get(Calendar.YEAR));
   assertEquals(11 - 1, actual.get(Calendar.MONTH));
   assertEquals(1, actual.get(Calendar.DAY_OF_MONTH));
 }
예제 #4
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));
 }
예제 #5
0
 public String getDialyDateText() {
   return Utils.toString(dialyDate);
 }
예제 #6
0
 public void testGetLastDayOfMonth() {
   Date orig = DateUtil.toDate("2003-03-24", "yyyy-MM-dd");
   Date actual = Utils.getLastDayOfMonth(orig);
   assertEquals("2003-03-31", DateUtil.toString(actual));
 }