FilenameDateExtractor { public boolean isValidFilename(File file) { try { timeStampExtractor.extractTimeStamps(file.getName()); return true; } catch (ValidationException ignored) { return false; } } FilenameDateExtractor(); boolean isValidFilename(File file); ProductData.UTC getDate(File file);  }
@Test public void testIsValidFilename() { assertEquals(true, filenameDateExtractor.isValidFilename(new File("20020304_blah.shp"))); assertEquals(false, filenameDateExtractor.isValidFilename(new File("20020304_blah.InvalidExtension"))); assertEquals(false, filenameDateExtractor.isValidFilename(new File("TextInFrontOfDate_20020304_blah.shp"))); assertEquals(false, filenameDateExtractor.isValidFilename(new File("2002_03_04_InvalidDateFormat.shp"))); }