@Test public void testFileTypeExtensions() throws Exception { FileTypeDetector detector = new FileTypeDetector(); String[] filenames = { "syslog.dat", "syslog.dat.1", "syslog.txt", "syslog.txt.1", "titanic.csv", "titanic.csv.1", "titanic.csv.1.2", "noextension" }; for (String filename : filenames) { String mimeType = detector.detectFileType(filename); Assert.assertNotEquals("UNKNOWN", mimeType); Assert.assertEquals("text/plain", mimeType); } }
public String detectFileType(Location location) { return detectFileType(location.getName()); }
FileTypeDetector { public String detectFileType(Location location) { return detectFileType(location.getName()); } }
FileTypeDetector { public String detectFileType(Location location) { return detectFileType(location.getName()); } FileTypeDetector(); }
FileTypeDetector { public String detectFileType(Location location) { return detectFileType(location.getName()); } FileTypeDetector(); boolean isWrangleable(String type); String detectFileType(Location location); String detectFileType(String location); }
FileTypeDetector { public String detectFileType(Location location) { return detectFileType(location.getName()); } FileTypeDetector(); boolean isWrangleable(String type); String detectFileType(Location location); String detectFileType(String location); static final String UNKNOWN; }