### Question:
FileTypeImpl { public final static String getFileType(File file) { String filetype = null; byte[] b = new byte[50]; try ( InputStream is = new FileInputStream(file) ) { is.read(b); filetype = getFileTypeByStream(b); is.close(); } catch (IOException e) { e.printStackTrace(); } return filetype; }  final static String getFileType(File file); final static String getFileTypeByStream(byte[] b); final static String getFileHexString(byte[] b); final static Map<String, String> FILE_TYPE_MAP; }### Answer:
@Test public void testFileType() { assertEquals("gif", FileTypeImpl.getFileType(new File(TestUtil.path + "/image/ali.gif"))); assertEquals("png", FileTypeImpl.getFileType(new File(TestUtil.path + "/image/tgepng"))); }