### Question:
DateExtractionHelper { public static int countDates(ExtractedDate date, List<? extends ExtractedDate> dates, DateExactness exactness) { int count = 0; for (ExtractedDate currentDate : dates) { if (date.equals(currentDate)) { continue; } DateExactness thisExactness = exactness; if (exactness == DateExactness.UNSET) { thisExactness = DateExactness.getCommonExactness(date.getExactness(), currentDate.getExactness()); } DateComparator dc = new DateComparator(thisExactness); if (dc.compare(date, currentDate) == 0) { count++; } } return count; } private  DateExtractionHelper(); static List<T> filter(List<? extends ExtractedDate> dates, Class<T> filter); static List<T> filterByRange(List<T> dates); static List<T> filterFullDate(List<T> dates); static List<List<T>> cluster(List<T> dates, DateExactness compareDepth); static int countDates(ExtractedDate date, List<? extends ExtractedDate> dates, DateExactness exactness); static List<E> getRatedDates(List<RatedDate<E>> dates, double rate); static List<D> filterExactest(List<D> dates); static double getHighestRate(List<? extends RatedDate<?>> ratedDates); static boolean isDateInRange(ExtractedDate date); static List<RatedDate<T>> setRate(List<T> dates, double rate);  }### Answer:
@Test public void testCountDates() { ExtractedDate date1 = DateParser.parseDate("2010-08-01 12:00:00", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date2 = DateParser.parseDate("2010-08-01 12:00:30", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date3 = DateParser.parseDate("2010-08-01 12:30:30", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date4 = DateParser.parseDate("2010-08-01 13:00:00", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date5 = DateParser.parseDate("2010-08-02 12:00:00", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date6 = DateParser.parseDate("2010-09-01 12:00:00", RegExp.DATE_ISO8601_YMD_T); ExtractedDate date7 = DateParser.parseDate("2011-09-01 12:00:00", RegExp.DATE_ISO8601_YMD_T); List<ExtractedDate> dateList = Arrays.asList(date1, date2, date3, date4, date5, date6, date7); assertEquals(5, DateExtractionHelper.countDates(date1, dateList, DateExactness.YEAR)); assertEquals(4, DateExtractionHelper.countDates(date1, dateList, DateExactness.MONTH)); assertEquals(3, DateExtractionHelper.countDates(date1, dateList, DateExactness.DAY)); assertEquals(2, DateExtractionHelper.countDates(date1, dateList, DateExactness.HOUR)); assertEquals(1, DateExtractionHelper.countDates(date1, dateList, DateExactness.MINUTE)); assertEquals(0, DateExtractionHelper.countDates(date1, dateList, DateExactness.SECOND)); }