### Question:
DateAndTimeTagger implements Tagger { @Override public List<Annotation> getAnnotations(String text) { List<Annotation> annotations = new ArrayList<>(); List<ExtractedDate> allDates = DateParser.findDates(text, dateFormats); for (ExtractedDate dateTime : allDates) { List<Integer> occurrenceIndices = StringHelper.getOccurrenceIndices(text, dateTime.getDateString()); for (Integer index : occurrenceIndices) { annotations.add(new ImmutableAnnotation(index, dateTime.getDateString(), DATETIME_TAG_NAME)); } } return annotations; } DateAndTimeTagger(DateFormat... dateFormats); @Override List<Annotation> getAnnotations(String text); static final String DATETIME_TAG_NAME; static final DateAndTimeTagger DEFAULT; }### Answer:
@Test public void testDateAndTimeTagging() { DateAndTimeTagger tagger = DateAndTimeTagger.DEFAULT; List<Annotation> annotations = tagger .getAnnotations("The mayan calendar ends on 21.12.2012, nobody knows what happens after end of 12/2012."); assertEquals(2, annotations.size()); assertEquals(27, annotations.get(0).getStartPosition()); assertEquals(10, annotations.get(0).getValue().length()); }