IO work
This commit is contained in:
parent
a48a53ad57
commit
0c7f708028
|
@ -15,26 +15,26 @@ public class JavaFileIntegrationTest {
|
|||
// create a file
|
||||
|
||||
@Test
|
||||
public void givenUsingJDK6_whenCreatingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingJDK6_whenCreatingFile_thenCorrect() throws IOException {
|
||||
final File newFile = new File("src/test/resources/newFile_jdk6.txt");
|
||||
newFile.createNewFile();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUsingJDK7nio2_whenCreatingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingJDK7nio2_whenCreatingFile_thenCorrect() throws IOException {
|
||||
final Path newFilePath = Paths.get("src/test/resources/newFile_jdk7.txt");
|
||||
Files.createFile(newFilePath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenUsingApache_whenCreatingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingApache_whenCreatingFile_thenCorrect() throws IOException {
|
||||
FileUtils.touch(new File("src/test/resources/newFile_commonsio.txt"));
|
||||
}
|
||||
|
||||
// move a file
|
||||
|
||||
@Test
|
||||
public void givenUsingJDK6_whenMovingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingJDK6_whenMovingFile_thenCorrect() throws IOException {
|
||||
final File fileToMove = new File("src/test/resources/toMoveFile_jdk6.txt");
|
||||
fileToMove.exists();
|
||||
final File destDir = new File("src/test/resources/");
|
||||
|
@ -47,7 +47,7 @@ public class JavaFileIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenUsingJDK7Nio2_whenMovingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingJDK7Nio2_whenMovingFile_thenCorrect() throws IOException {
|
||||
final Path fileToMovePath = Files.createFile(Paths.get("src/test/resources/fileToMove.txt"));
|
||||
final Path dirPath = Paths.get("src/test/resources/");
|
||||
final Path targetPath = Files.createDirectory(dirPath);
|
||||
|
@ -56,7 +56,7 @@ public class JavaFileIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenUsingGuava_whenMovingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingGuava_whenMovingFile_thenCorrect() throws IOException {
|
||||
final File fileToMove = new File("src/test/resources/fileToMove.txt");
|
||||
fileToMove.createNewFile();
|
||||
final File destDir = new File("src/test/resources/");
|
||||
|
@ -66,10 +66,16 @@ public class JavaFileIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void givenUsingApache_whenMovingFile_thenCorrect() throws IOException {
|
||||
public final void givenUsingApache_whenMovingFile_thenCorrect() throws IOException {
|
||||
FileUtils.moveFile(FileUtils.getFile("src/test/resources/fileToMove.txt"), FileUtils.getFile("src/test/resources/fileMoved.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void givenUsingApache_whenMovingFileApproach2_thenCorrect() throws IOException {
|
||||
FileUtils.touch(new File("src/test/resources/fileToMove.txt"));
|
||||
FileUtils.moveFileToDirectory(FileUtils.getFile("src/test/resources/fileToMove.txt"), FileUtils.getFile("src/main/resources/"), true);
|
||||
}
|
||||
|
||||
// rename a file
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue