@Test public void testCreateRandomDirectoryExistingRoot() throws IOException { Assert.assertTrue(tmpFolder.getRoot().exists()); Assert.assertEquals(0, tmpFolder.getRoot().listFiles().length); File newRoot = new File(tmpFolder.getRoot().getAbsolutePath() + File.separator + "test1"); newRoot.mkdirs(); Assert.assertTrue(newRoot.exists()); File randomDirectory = FileUtils.createRandomDirectory(newRoot); Assert.assertTrue(randomDirectory.exists()); Assert.assertTrue(randomDirectory.getParentFile().equals(newRoot)); }
public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; }
FileUtils { public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; } }
FileUtils { public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; } private  FileUtils(); }
FileUtils { public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; } private  FileUtils(); static void addToZipFile(final File file, final ZipOutputStream zos); static File createRandomDirectory(final File parentDir); }
FileUtils { public static File createRandomDirectory(final File parentDir) throws IOException { final String tempDirName = RandomStringUtils.randomAlphabetic(15); final File tempDir = new File(parentDir.getAbsoluteFile() + File.separator + tempDirName); org.apache.commons.io.FileUtils.forceMkdir(tempDir); return tempDir; } private  FileUtils(); static void addToZipFile(final File file, final ZipOutputStream zos); static File createRandomDirectory(final File parentDir);  }