### Question:
DateComparator implements Comparator<ExtractedDate> { @Override public int compare(ExtractedDate date1, ExtractedDate date2) { int returnValue = compare(date1.get(ExtractedDate.YEAR), date2.get(ExtractedDate.YEAR)); if (returnValue == 0 && dateExactness.provides(DateExactness.MONTH)) { returnValue = compare(date1.get(ExtractedDate.MONTH), date2.get(ExtractedDate.MONTH)); if (returnValue == 0 && dateExactness.provides(DateExactness.DAY)) { returnValue = compare(date1.get(ExtractedDate.DAY), date2.get(ExtractedDate.DAY)); if (returnValue == 0 && dateExactness.provides(DateExactness.HOUR)) { returnValue = compare(date1.get(ExtractedDate.HOUR), date2.get(ExtractedDate.HOUR)); if (returnValue == 0 && dateExactness.provides(DateExactness.MINUTE)) { returnValue = compare(date1.get(ExtractedDate.MINUTE), date2.get(ExtractedDate.MINUTE)); if (returnValue == 0 && dateExactness.provides(DateExactness.SECOND)) { returnValue = compare(date1.get(ExtractedDate.SECOND), date2.get(ExtractedDate.SECOND)); } } } } } return returnValue; } DateComparator(DateExactness dateExactness);  DateComparator(); @Override int compare(ExtractedDate date1, ExtractedDate date2); @Deprecated List<T> orderDates(Collection<T> dates, boolean reverse); T getOldestDate(Collection<T> dates); T getYoungestDate(Collection<T> dates);  }### Answer:
@Test public void testDateComparator2() { DateComparator comparator = new DateComparator(DateExactness.DAY); assertEquals(0, comparator.compare(date7, date8)); assertEquals(-1, comparator.compare(date6, date7)); comparator = new DateComparator(DateExactness.HOUR); assertEquals(0, comparator.compare(date7, date9)); assertEquals(-1, comparator.compare(date7, date8)); }