本文整理了Java中org.assertj.core.util.Files.createFileIfPathIsNotANonEmptyDirectory()
方法的一些代码示例,展示了Files.createFileIfPathIsNotANonEmptyDirectory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Files.createFileIfPathIsNotANonEmptyDirectory()
方法的具体详情如下:
包路径:org.assertj.core.util.Files
类名称:Files
方法名:createFileIfPathIsNotANonEmptyDirectory
暂无
代码示例来源:origin: org.assertj/assertj-core
/**
* Creates a new file using the given path.
*
* @param path the path of the new file.
* @return the new created file.
* @throws RuntimeException if the path belongs to an existing non-empty directory.
* @throws RuntimeException if the path belongs to an existing file.
* @throws UncheckedIOException if any I/O error is thrown when creating the new file.
*/
public static File newFile(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.createNewFile()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (IOException e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
代码示例来源:origin: org.assertj/assertj-core
/**
* Creates a new directory using the given path.
*
* @param path the path of the new directory.
* @return the new created directory.
* @throws RuntimeException if the path belongs to an existing non-empty directory.
* @throws RuntimeException if the path belongs to an existing file.
* @throws RuntimeException if any I/O error is thrown when creating the new directory.
*/
public static File newFolder(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.mkdir()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (Exception e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Creates a new file using the given path.
*
* @param path the path of the new file.
* @return the new created file.
* @throws RuntimeException if the path belongs to an existing non-empty directory.
* @throws RuntimeException if the path belongs to an existing file.
* @throws UncheckedIOException if any I/O error is thrown when creating the new file.
*/
public static File newFile(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.createNewFile()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (IOException e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Creates a new directory using the given path.
*
* @param path the path of the new directory.
* @return the new created directory.
* @throws RuntimeException if the path belongs to an existing non-empty directory.
* @throws RuntimeException if the path belongs to an existing file.
* @throws RuntimeException if any I/O error is thrown when creating the new directory.
*/
public static File newFolder(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.mkdir()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (Exception e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
代码示例来源:origin: org.assertj/assertj-core-java8
/**
* Creates a new file using the given path.
*
* @param path the path of the new file.
* @return the new created file.
* @throws FilesException if the path belongs to an existing non-empty directory.
* @throws FilesException if the path belongs to an existing file.
* @throws FilesException if any I/O error is thrown when creating the new file.
*/
public static File newFile(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.createNewFile()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (IOException e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
代码示例来源:origin: org.assertj/assertj-core-java8
/**
* Creates a new directory using the given path.
*
* @param path the path of the new directory.
* @return the new created directory.
* @throws FilesException if the path belongs to an existing non-empty directory.
* @throws FilesException if the path belongs to an existing file.
* @throws FilesException if any I/O error is thrown when creating the new directory.
*/
public static File newFolder(String path) {
File file = createFileIfPathIsNotANonEmptyDirectory(path);
try {
if (!file.mkdir()) {
throw cannotCreateNewFile(path, "a file was found with the same path");
}
} catch (Exception e) {
throw cannotCreateNewFile(path, e);
}
return file;
}
内容来源于网络,如有侵权,请联系作者删除!