@Test public void createDirectory_whenFileAlreadyExistsButIsNotADirectory_shouldReturnNull() throws Exception { File file = new File(expectedFilePath); file.createNewFile(); assertThat(file.exists()).isTrue(); assertThat(file.isDirectory()).isFalse(); File directory = Files.createDirectory(expectedFilePath); assertThat(directory).isNull(); file.delete(); }
public static File createDirectory(String absolutePath) { if (absolutePath == null) { return null; } File directory = new File(absolutePath); if (directory.exists() && directory.isDirectory() || directory.mkdirs() && directory.isDirectory()) { return directory; } return null; }
Files { public static File createDirectory(String absolutePath) { if (absolutePath == null) { return null; } File directory = new File(absolutePath); if (directory.exists() && directory.isDirectory() || directory.mkdirs() && directory.isDirectory()) { return directory; } return null; } }
Files { public static File createDirectory(String absolutePath) { if (absolutePath == null) { return null; } File directory = new File(absolutePath); if (directory.exists() && directory.isDirectory() || directory.mkdirs() && directory.isDirectory()) { return directory; } return null; }  }
Files { public static File createDirectory(String absolutePath) { if (absolutePath == null) { return null; } File directory = new File(absolutePath); if (directory.exists() && directory.isDirectory() || directory.mkdirs() && directory.isDirectory()) { return directory; } return null; }  static File createDirectory(String absolutePath); static int intLength(File file); }
Files { public static File createDirectory(String absolutePath) { if (absolutePath == null) { return null; } File directory = new File(absolutePath); if (directory.exists() && directory.isDirectory() || directory.mkdirs() && directory.isDirectory()) { return directory; } return null; }  static File createDirectory(String absolutePath); static int intLength(File file);  }