AdeFileUtils { public static void createDir(File target) throws AdeUsageException { if (!target.exists() && !target.mkdir()) { throw new AdeUsageException("Failed creating directory " + target.getPath()); } } private  AdeFileUtils(); static void copyFile(File source, File target); static BufferedReader openLogFile(File file); static InputStream openLogFileAsInputStream(File file); static void deleteFile(File file); static void deleteFileOrLog(File file); static void createDir(File target); static void createDirs(File target); static boolean deleteRecursiveOrLog(File path);  }
@Test public void testCreateDir() throws AdeUsageException, IOException { final File targetDir = temporaryFolder.newFolder("dir1"); final File newDir = new File(targetDir.getPath()+"/newdir"); AdeFileUtils.createDir(newDir); assertTrue("Verify the directory was created.", newDir.exists()); }
@Test(expected = AdeUsageException.class) public void testCreateDirBadPath() throws AdeUsageException, IOException { final File badPath = new File(""); AdeFileUtils.createDir(badPath); }
@Test public void testCreateDirFileExists() throws AdeUsageException, IOException { final File aFile = temporaryFolder.newFile(); AdeFileUtils.createDir(aFile); assertTrue("Verify the file is still there.", aFile.exists()); }