### Question:
UtilFile { public static String getExtension(String file) { Check.notNull(file); String ext = Constant.EMPTY_STRING; final int i = file.lastIndexOf(Constant.DOT); if (i >= 0 && i < file.length() - 1) { ext = file.substring(i + 1).toLowerCase(Locale.ENGLISH); } return ext; } private  UtilFile(); static String removeExtension(String file); static String normalizeExtension(String file, String extension); static String getExtension(String file); static String getExtension(File file); static List<File> getFiles(File directory); static List<File> getFilesByExtension(File path, String extension); static List<File> getFilesByName(File path, String name); static void deleteFile(File file); static boolean exists(String path); static boolean isFile(String path); static boolean isType(File file, String extension);  }### Answer:
@Test void testGetExtension() { assertEquals("", UtilFile.getExtension("tmp")); assertEquals("tmp", UtilFile.getExtension(".tmp")); assertEquals("tmp", UtilFile.getExtension("temp.tmp")); assertEquals("t", UtilFile.getExtension("temp.t")); assertEquals(Constant.EMPTY_STRING, UtilFile.getExtension("temp.")); assertEquals(Constant.EMPTY_STRING, UtilFile.getExtension("temp")); }
@Test void testGetExtensionNull() { assertThrows(() -> UtilFile.getExtension((String) null), Check.ERROR_NULL); }
@Test void testGetExtensionFile() { assertEquals("tmp", UtilFile.getExtension(new File("temp.tmp"))); assertEquals("t", UtilFile.getExtension(new File("toto", "temp.t"))); assertEquals(Constant.EMPTY_STRING, UtilFile.getExtension(new File("temp."))); assertEquals(Constant.EMPTY_STRING, UtilFile.getExtension(new File("temp"))); }
@Test void testGetExtensionFileNull() { assertThrows(() -> UtilFile.getExtension((File) null), Check.ERROR_NULL); }