private void visit(Set<String> names, String prefix, File file) { for (File child : file.listFiles()) { if (child.isFile()) { names.add(prefix + child.getName()); } else if (child.isDirectory()) { visit(names, prefix + child.getName() + "/", child); } } }
private static void delete(File directory) { for (File file : directory.listFiles()) { if (file.isDirectory()) { delete(file); } else { assertTrue(file.delete()); } } assertTrue(directory.delete()); }
public File getTestOutputDirectory() { final File directory = new File( System.getProperty( "maven.project.build.testOutputDirectory", System.getProperty("project.build.testOutputDirectory", "target/test-classes"))); assertTrue(directory.isDirectory()); assertTrue(directory.canWrite()); return directory; }
public void moveToDirectory(File target) { if (target.exists() && !target.isDirectory()) { throw new RuntimeException(String.format("Target '%s' is not a directory", target)); } try { FileUtils.moveFileToDirectory(this, target, true); } catch (IOException e) { throw new RuntimeException( String.format("Could not move test file '%s' to directory '%s'", this, target), e); } }
@Test public void test_main_offline() throws IOException { File offline = new File("OfflineData.bin"); if (offline.exists() && !offline.isDirectory()) { this.getLogger().info("OfflineData.bin file exists."); if (GraphicsEnvironment.isHeadless()) { this.binFileReader = new BinFileReader(offline); } else { this.binFileReader = new BinFileReaderGui(offline); } do_read_from_bin(); System.out.println(""); } else { getLogger().warning("No OfflineData.bin file!"); } }
private void checkFolderExists(String path) throws BrutException { File f = new File(sTestNewDir, path); assertTrue(f.isDirectory()); }