@Test public void testCreationOfTmpDir() throws IOException{ File dir = JUnitAnalyzer.createNewTmpDir(); Assert.assertNotNull(dir); Assert.assertTrue(dir.exists()); FileUtils.deleteDirectory(dir); Assert.assertFalse(dir.exists()); }
protected static File createNewTmpDir() { File dir = null; String dirName = FileUtils.getTempDirectoryPath() + File.separator + "EvoSuite_" + (dirCounter++) + "_" + +System.currentTimeMillis(); dir = new File(dirName); if (!dir.mkdirs()) { logger.error("Cannot create tmp dir: " + dirName); return null; } if (!dir.exists()) { logger.error("Weird behavior: we created folder, but Java cannot determine if it exists? Folder: " + dirName); return null; } return dir; }
JUnitAnalyzer { protected static File createNewTmpDir() { File dir = null; String dirName = FileUtils.getTempDirectoryPath() + File.separator + "EvoSuite_" + (dirCounter++) + "_" + +System.currentTimeMillis(); dir = new File(dirName); if (!dir.mkdirs()) { logger.error("Cannot create tmp dir: " + dirName); return null; } if (!dir.exists()) { logger.error("Weird behavior: we created folder, but Java cannot determine if it exists? Folder: " + dirName); return null; } return dir; } }
JUnitAnalyzer { protected static File createNewTmpDir() { File dir = null; String dirName = FileUtils.getTempDirectoryPath() + File.separator + "EvoSuite_" + (dirCounter++) + "_" + +System.currentTimeMillis(); dir = new File(dirName); if (!dir.mkdirs()) { logger.error("Cannot create tmp dir: " + dirName); return null; } if (!dir.exists()) { logger.error("Weird behavior: we created folder, but Java cannot determine if it exists? Folder: " + dirName); return null; } return dir; }  }
JUnitAnalyzer { protected static File createNewTmpDir() { File dir = null; String dirName = FileUtils.getTempDirectoryPath() + File.separator + "EvoSuite_" + (dirCounter++) + "_" + +System.currentTimeMillis(); dir = new File(dirName); if (!dir.mkdirs()) { logger.error("Cannot create tmp dir: " + dirName); return null; } if (!dir.exists()) { logger.error("Weird behavior: we created folder, but Java cannot determine if it exists? Folder: " + dirName); return null; } return dir; }  static void removeTestsThatDoNotCompile(List<TestCase> tests); static int handleTestsThatAreUnstable(List<TestCase> tests); static boolean isJavaCompilerAvailable(); static boolean verifyCompilationAndExecution(List<TestCase> tests); }
JUnitAnalyzer { protected static File createNewTmpDir() { File dir = null; String dirName = FileUtils.getTempDirectoryPath() + File.separator + "EvoSuite_" + (dirCounter++) + "_" + +System.currentTimeMillis(); dir = new File(dirName); if (!dir.mkdirs()) { logger.error("Cannot create tmp dir: " + dirName); return null; } if (!dir.exists()) { logger.error("Weird behavior: we created folder, but Java cannot determine if it exists? Folder: " + dirName); return null; } return dir; }  static void removeTestsThatDoNotCompile(List<TestCase> tests); static int handleTestsThatAreUnstable(List<TestCase> tests); static boolean isJavaCompilerAvailable(); static boolean verifyCompilationAndExecution(List<TestCase> tests);  }