diff options
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java index bcecada52e..f05b1d5edd 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java @@ -19,6 +19,7 @@ import static com.google.devtools.build.lib.vfs.FileSystemUtils.copyFile; import static com.google.devtools.build.lib.vfs.FileSystemUtils.copyTool; import static com.google.devtools.build.lib.vfs.FileSystemUtils.createDirectoryAndParents; import static com.google.devtools.build.lib.vfs.FileSystemUtils.deleteTree; +import static com.google.devtools.build.lib.vfs.FileSystemUtils.moveFile; import static com.google.devtools.build.lib.vfs.FileSystemUtils.relativePath; import static com.google.devtools.build.lib.vfs.FileSystemUtils.removeExtension; import static com.google.devtools.build.lib.vfs.FileSystemUtils.touchFile; @@ -352,6 +353,21 @@ public class FileSystemUtilsTest { } @Test + public void testMoveFile() throws IOException { + createTestDirectoryTree(); + Path originalFile = file1; + byte[] content = new byte[] { 'a', 'b', 'c', 23, 42 }; + FileSystemUtils.writeContent(originalFile, content); + + Path moveTarget = file2; + + moveFile(originalFile, moveTarget); + + assertTrue(Arrays.equals(content, FileSystemUtils.readContent(moveTarget))); + assertFalse(originalFile.exists()); + } + + @Test public void testReadContentWithLimit() throws IOException { createTestDirectoryTree(); String str = "this is a test of readContentWithLimit method"; |