### Question:
DateUtils { public Boolean isEventExpired(@Nullable Date currentDate, Date completedDay, int compExpDays) { Calendar calendar = getCalendar(); if (currentDate != null) calendar.setTime(currentDate); Date date = calendar.getTime(); return completedDay != null && compExpDays > 0 && completedDay.getTime() + TimeUnit.DAYS.toMillis(compExpDays) < date.getTime(); }  static DateUtils getInstance(); Date[] getDateFromDateAndPeriod(Date date, Period period); Date getToday(); @NonNull static SimpleDateFormat uiDateFormat(); @NonNull static SimpleDateFormat oldUiDateFormat(); @NonNull static SimpleDateFormat timeFormat(); @NonNull static SimpleDateFormat dateTimeFormat(); @NonNull static SimpleDateFormat databaseDateFormat(); @NonNull static SimpleDateFormat databaseDateFormatNoMillis(); @NonNull static SimpleDateFormat databaseDateFormatNoSeconds(); @Nonnull static Boolean dateHasNoSeconds(String dateTime); String formatDate(Date dateToFormat); Calendar getCalendar(); void setCurrentDate(Date date); static int[] getDifference(Date startDate, Date endDate); Date expDate(@Nullable Date currentDate, int expiryDays, @Nullable PeriodType expiryPeriodType); Date getNextPeriod(PeriodType period, Date currentDate, int page); Date getNextPeriod(PeriodType period, Date currentDate, int page, boolean lastDate); String getPeriodUIString(PeriodType periodType, Date date, Locale locale); Boolean isEventExpired(@Nullable Date currentDate, Date completedDay, int compExpDays); Boolean isEventExpired(Date eventDate, Date completeDate, EventStatus status, int compExpDays, PeriodType programPeriodType, int expDays); Boolean isDataSetExpired(int expiredDays, Date periodInitialDate); Boolean isInsideInputPeriod(DataInputPeriod dataInputPeriodModel); String generateId(PeriodType periodType, Date date, Locale locale); List<DatePeriod> getDatePeriodListFor(List<Date> selectedDates, Period period); void showFromToSelector(ActivityGlobalAbstract activity, OnFromToSelector fromToListener); void showPeriodDialog(ActivityGlobalAbstract activity, OnFromToSelector fromToListener, boolean fromOtherPeriod); static Date yearsBeforeNow(int years); static Date yearsAfterNow(int years); static long timeToDate(Date finaLDate); static final String DATABASE_FORMAT_EXPRESSION; static final String DATABASE_FORMAT_EXPRESSION_NO_MILLIS; static final String DATABASE_FORMAT_EXPRESSION_NO_SECONDS; static final String DATE_TIME_FORMAT_EXPRESSION; static final String DATE_FORMAT_EXPRESSION; static final String SIMPLE_DATE_FORMAT; }### Answer:
@Test public void isEventExpired() throws ParseException { String completedDate = "2018-09-13"; int compExpDays = 2; String[] currentDates = new String[]{ "2018-09-14", "2018-09-17", "2018-09-15", "2018-09-11" }; Boolean[] expectedResults = new Boolean[]{ false, true, false, false }; Date testDate = DateUtils.oldUiDateFormat().parse(completedDate); int i = 0; for (String date : currentDates) { Boolean isExpired = DateUtils.getInstance().isEventExpired( DateUtils.oldUiDateFormat().parse(date), testDate, compExpDays); assertEquals(expectedResults[i], isExpired); i++; } }