aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java b/src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java
index f9d0372e0a..023b41e57c 100644
--- a/src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java
+++ b/src/test/java/com/google/devtools/build/lib/exec/SingleBuildFileCacheTest.java
@@ -24,6 +24,7 @@ import com.google.devtools.build.lib.actions.DigestOfDirectoryException;
import com.google.devtools.build.lib.testutil.Suite;
import com.google.devtools.build.lib.testutil.TestSpec;
import com.google.devtools.build.lib.vfs.FileSystem;
+import com.google.devtools.build.lib.vfs.LocalPath;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
import com.google.protobuf.ByteString;
@@ -54,23 +55,23 @@ public class SingleBuildFileCacheTest {
public final void setUp() throws Exception {
calls = new HashMap<>();
md5Overrides = new HashMap<>();
- fs = new InMemoryFileSystem() {
- @Override
- protected InputStream getInputStream(Path path) throws IOException {
- int c = calls.containsKey(path.toString())
- ? calls.get(path.toString()) : 0;
- c++;
- calls.put(path.toString(), c);
- return super.getInputStream(path);
- }
-
- @Override
- protected byte[] getDigest(Path path, HashFunction hf) throws IOException {
- assertThat(hf).isEqualTo(HashFunction.MD5);
- byte[] override = md5Overrides.get(path.getPathString());
- return override != null ? override : super.getDigest(path, hf);
- }
- };
+ fs =
+ new InMemoryFileSystem() {
+ @Override
+ protected InputStream getInputStream(LocalPath path) throws IOException {
+ int c = calls.containsKey(path.toString()) ? calls.get(path.toString()) : 0;
+ c++;
+ calls.put(path.toString(), c);
+ return super.getInputStream(path);
+ }
+
+ @Override
+ protected byte[] getDigest(LocalPath path, HashFunction hf) throws IOException {
+ assertThat(hf).isEqualTo(HashFunction.MD5);
+ byte[] override = md5Overrides.get(path.getPathString());
+ return override != null ? override : super.getDigest(path, hf);
+ }
+ };
underTest = new SingleBuildFileCache("/", fs);
Path root = fs.getRootDirectory();
Path file = root.getChild("empty");