aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2016-01-26 15:40:42 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-01-27 15:09:16 +0000
commit7ecb2ce38776d87241fd00b4318489372068e4f3 (patch)
tree29a7af4772ebf44a7b6408e863dec49ae9cab069 /src/test/java/com/google
parent72384a27a18d72cad160c8cfc47f5cbb1a91cc51 (diff)
Rename FilesystemUtils to NativePosixFiles.
This helps avoid confusion with File*S*ystemUtils, which differs in only the case of a character but is a completely different class. -- MOS_MIGRATED_REVID=113054116
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java (renamed from src/test/java/com/google/devtools/build/lib/unix/FilesystemUtilsTest.java)12
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java7
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java5
3 files changed, 13 insertions, 11 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/unix/FilesystemUtilsTest.java b/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java
index dafcb1c030..46522a7459 100644
--- a/src/test/java/com/google/devtools/build/lib/unix/FilesystemUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java
@@ -36,7 +36,7 @@ import java.io.FileNotFoundException;
* This class tests the FilesystemUtils class.
*/
@RunWith(JUnit4.class)
-public class FilesystemUtilsTest {
+public class NativePosixFilesTest {
private FileSystem testFS;
private Path workingDir;
private Path testFile;
@@ -71,7 +71,7 @@ public class FilesystemUtilsTest {
for (String testInput : testVectors.keySet()) {
FileSystemUtils.writeContentAsLatin1(testFile, testInput);
- HashCode result = FilesystemUtils.md5sum(testFile.getPathString());
+ HashCode result = NativePosixFiles.md5sum(testFile.getPathString());
assertThat(testVectors).containsEntry(testInput, result.toString());
}
}
@@ -79,10 +79,10 @@ public class FilesystemUtilsTest {
@Test
public void throwsFileAccessException() throws Exception {
FileSystemUtils.createEmptyFile(testFile);
- FilesystemUtils.chmod(testFile.getPathString(), 0200);
+ NativePosixFiles.chmod(testFile.getPathString(), 0200);
try {
- FilesystemUtils.md5sum(testFile.getPathString());
+ NativePosixFiles.md5sum(testFile.getPathString());
fail("Expected FileAccessException, but wasn't thrown.");
} catch (FileAccessException e) {
assertThat(e).hasMessage(testFile + " (Permission denied)");
@@ -92,7 +92,7 @@ public class FilesystemUtilsTest {
@Test
public void throwsFileNotFoundException() throws Exception {
try {
- FilesystemUtils.md5sum(testFile.getPathString());
+ NativePosixFiles.md5sum(testFile.getPathString());
fail("Expected FileNotFoundException, but wasn't thrown.");
} catch (FileNotFoundException e) {
assertThat(e).hasMessage(testFile + " (No such file or directory)");
@@ -103,7 +103,7 @@ public class FilesystemUtilsTest {
public void throwsFilePermissionException() throws Exception {
File foo = new File("/bin");
try {
- FilesystemUtils.setWritable(foo);
+ NativePosixFiles.setWritable(foo);
fail("Expected FilePermissionException, but wasn't thrown.");
} catch (FilePermissionException e) {
assertThat(e).hasMessage(foo + " (Operation not permitted)");
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
index 920e33043f..aba86119ab 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
import com.google.common.io.BaseEncoding;
import com.google.devtools.build.lib.testutil.TestUtils;
+import com.google.devtools.build.lib.unix.NativePosixFiles;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.Preconditions;
@@ -102,15 +103,15 @@ public abstract class FileSystemTest {
protected abstract FileSystem getFreshFileSystem() throws IOException;
protected boolean isSymbolicLink(File file) {
- return com.google.devtools.build.lib.unix.FilesystemUtils.isSymbolicLink(file);
+ return NativePosixFiles.isSymbolicLink(file);
}
protected void setWritable(File file) throws IOException {
- com.google.devtools.build.lib.unix.FilesystemUtils.setWritable(file);
+ NativePosixFiles.setWritable(file);
}
protected void setExecutable(File file) throws IOException {
- com.google.devtools.build.lib.unix.FilesystemUtils.setExecutable(file);
+ NativePosixFiles.setExecutable(file);
}
private static final Pattern STAT_SUBDIR_ERROR = Pattern.compile("(.*) \\(Not a directory\\)");
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java
index 40ace2b6f6..46b200baff 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java
@@ -18,7 +18,8 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import com.google.devtools.build.lib.unix.FilesystemUtils;
+import com.google.devtools.build.lib.unix.NativePosixFiles;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -68,7 +69,7 @@ public class UnixFileSystemTest extends SymlinkAwareFileSystemTest {
Path regular = absolutize("regular");
Path fifo = absolutize("fifo");
FileSystemUtils.createEmptyFile(regular);
- FilesystemUtils.mkfifo(fifo.toString(), 0777);
+ NativePosixFiles.mkfifo(fifo.toString(), 0777);
assertTrue(regular.isFile());
assertFalse(regular.isSpecialFile());
assertTrue(regular.stat().isFile());