FileUtil { public static String getFileName(String _file_path) { return FileUtil.getFileName(_file_path, true); }  static String getFileExtension(File _file); static boolean hasFileExtension(Path _p, String[] _extensions); static String toString(Set<Path> _paths, String _sep); static Path createTmpDir(String _prefix); static boolean isAccessibleFile(String _arg); static boolean isAccessibleFile(Path _arg); static final boolean isAccessibleDirectory(Path _dir); static final boolean isAccessibleDirectory(File _dir); static final boolean isAccessibleDirectory(String _dir); static final void createDirectory(Path _p); static String getFileName(String _file_path); static String getFileName(String _file_path, boolean _keep_ext); static String getCharsetName(); static Charset getCharset(); static Path copyFile(Path _source_file, Path _target_dir); static String readFile(String _p); static String readFile(Path _p); static String readInputStream(InputStream _is, Charset _cs); static byte[] readInputStream(InputStream _is); static final void writeToFile(File _f, String _content); static final Path writeToTmpFile(String _filename, String _suffix, String _content); static final void writeToFile(File _f, byte[] _content); static Set<Path> getPaths(String[] _paths); static Path getPath(String _path, boolean _create); static Path getPath(String _path); static final String getSHA1(File _file); static final String getDigest(File _file, DigestAlgorithm _alg); static String getJarFilePath(Class<?> _clazz); static String getJarFilePath(String _url); static Set<String> getJarFilePathsForResources(ClassLoader _cl, String[] _resources); static Set<String> getJarFilePaths(URLClassLoader _cl); static Boolean isZipped(File _f);  }
@Test public void testGetFileName() { final String name1 = FileUtil.getFileName("hello.min.js", false); assertEquals("hello.min", name1); final String name2 = FileUtil.getFileName("hello.js", false); assertEquals("hello", name2); final String name3 = FileUtil.getFileName(Paths.get("./project/js/hello.io.min.js").toString(), false); assertEquals("hello.io.min", name3); }