DateUtil { public static String getDate(Date aDate) { SimpleDateFormat df; String returnValue = ""; if (aDate != null) { df = new SimpleDateFormat(getDatePattern()); returnValue = df.format(aDate); } return (returnValue); } private  DateUtil(); static String getDatePattern(); static String getDateTimePattern(); static String getDate(Date aDate); static Date convertStringToDate(String aMask, String strDate); static String getTimeNow(Date theTime); static Calendar getToday(); static String getDateTime(String aMask, Date aDate); static String convertDateToString(Date aDate); static Date convertStringToDate(final String strDate);  }
@Test public void testGetDate() throws Exception { if (log.isDebugEnabled()) { log.debug("db date to convert: " + new Date()); } String date = DateUtil.getDate(new Date()); if (log.isDebugEnabled()) { log.debug("converted ui date: " + date); } assertTrue(date != null); }
@Test public void testGetDateWithNull() { final String date = DateUtil.getDate(null); assertEquals("", date); }