DateUtils { public static Date createDate(String dateString) { return createDate(dateString, "yyyy-MM-dd"); }  static Date createDate(String dateString); static Date createDate(String dateString,
                                  String dateFormat); static String getDateFormatMask(); static String getDateTimeFormatMask(); static String getDateStr(Date date); static String getDateTimeStr(Date date); static String getPrettyTime(Date date); static String DEFAULT_DATE_FORMAT_MASK; static String DEFAULT_DATE_AND_TIME_FORMAT_MASK; static String DEFAULT_TIME_FORMAT_MASK; }
@Test public void testCreateDateWithDefaultFormat() { Date date = createDate("2013-05-01"); assertEquals(2013, date.getYear() + 1900); assertEquals(05, date.getMonth() + 1); assertEquals(01, date.getDate()); }
@Test(expected = IllegalArgumentException.class) public void testCreateMalformedDateWithDefaultFormat() { createDate("2013-kk-05"); }