FileUtil { public static boolean isFileExists( final String dirAbsPath, final String fileName ) { return FileUtil.isFileExists( FilenameUtils.concat( dirAbsPath, fileName ) ); } private  FileUtil(); static boolean isFileExists( final String dirAbsPath, final String fileName ); static boolean isFileExists( final String fileAbsPath ); static boolean isDirExists( final String dirAbsPath ); static File[] findFiles( final String dirAbsPath, final String ext ); static boolean setFilesExecutable( final String dirAbsPath, final String ext ); static boolean extractArchive( final String archiveFileAbsPath, final String destDirAbsPath ); static boolean extractArchive( final File archiveFile, final File destDir ); static File[] findFiles( final String dirAbsPath, final String[] extensions, boolean recursive ); static File[] findFiles( final File dirAbsPath, final String[] extensions, boolean recursive ); static File[] findFiles( final String dirAbsPath, final String fileNamePattern, boolean recursive ); static String getFileChecksum( final String fileAbsPath, ChecksumMethod checksumMethod ); static boolean deleteDirectory( final String directory ); static boolean deleteDirectory( final File directory ); static String getTemporaryFolderPath(); static boolean deleteFile( final String filePath ); static boolean createDirectory( final String dirPath ); static String getFileBaseName( final String fileName ); static boolean unzipFile( final String zipFileAbsPath, final String outputDirAbsPath ); static boolean createOrUpdateFile( final String filePath, final String fileContent ); static boolean createOrUpdateFile( final String filePath, final String fileContent,
                                              final boolean createBackup ); static boolean createNewFile( final String fileAbsPath ); static String readFileToString( final String fileName ); static String findLatestFileByLastModified( final String directory, final String fileNamePattern,
                                                       final boolean recursive );  }
@Test public void testFileExistsWithInvalidFile() { String timeInMillis = this.getDateTimeInMillis(); assertFalse( FileUtil.isFileExists( FilenameUtils.concat( tmpDir, timeInMillis ) ) ); assertFalse( FileUtil.isFileExists( null ) ); assertFalse( FileUtil.isFileExists( null, timeInMillis ) ); assertFalse( FileUtil.isFileExists( tmpDir, null ) ); }