### Question:
DateTimeDetector implements CellDetector<DateColumnResults> { @Override public ValuesWithConfidence<DateColumnResults> detect(CellSampler sampler) { DateTimeFinder finder = new DateTimeFinder(myConfigurationProvider); finder.setIsJustDetectFormats(myIsJustDetectFormats); return new ValuesWithConfidence<DateColumnResults>(finder.findDates(sampler)); } DateTimeDetector(PreferencesRegistry prefsRegistry); @Override ValuesWithConfidence<DateColumnResults> detect(CellSampler sampler); void setIsJustDetectFormats(boolean isJustFormats);  }### Answer:
@Test public void testDetect() { DateFormatsConfig configuration = getDateFormats(); for (DateFormat format : configuration.getFormats()) { EasyMockSupport support = new EasyMockSupport(); PreferencesRegistry preferencesRegistry = createPreferencesRegistry(support, configuration); List<List<String>> data = DateDataGenerator.generateSingleDate(format); CellSampler cellSampler = createCellSampler(support, data); support.replayAll(); DateTimeDetector detector = new DateTimeDetector(preferencesRegistry); ValuesWithConfidence<DateColumnResults> value = detector.detect(cellSampler); if (format.getSdf().contains("y") && format.getType() == Type.TIMESTAMP || format.getType() == Type.DATE) { assertNotNull("Failed on format " + format.getSdf(), value.getBestValue().getUpTimeColumn()); assertEquals(format.getType(), value.getBestValue().getUpTimeColumn().getDateColumnType()); assertEquals(1, value.getBestValue().getUpTimeColumn().getPrimaryColumnIndex()); assertEquals(-1, value.getBestValue().getUpTimeColumn().getSecondaryColumnIndex()); assertNull(value.getBestValue().getDownTimeColumn()); } else { assertNull(value.getBestValue().getUpTimeColumn()); } support.verifyAll(); } }