### Question:
DateUtils { public static String toDateString(final Date date) { return formatDate(date, DateUtils.L_DATE_FORMAT); } private  DateUtils(); static Date parseAndComplete(final String dateExpression, final boolean upComplete); static String toDateTimeString(final Date date); static String toDateString(final Date date); static Date parseDate(final Object value); static Either<? extends Exception, Optional<DateTime>> tryParse(final Object value); static Date copy(final Date date); static final String L_DATE_FORMAT; static final String L_DATE_TIME_FORMAT; static final String L_REPORT_DATE_TIME_FORMAT; }### Answer:
@Test public final void shouldFormatDate() { final Date date = new DateTime(2013, 1, 1, 12, 30, 45, 0).toDate(); final String result = DateUtils.toDateString(date); assertEquals("2013-01-01", result); }
@Test public final void shouldFormatDateReturnEmptyStringForNull() { final String result = DateUtils.toDateString(null); assertEquals("", result); }