() {
+ @Override
+ public StorageRpc create(StorageOptions options) {
+ return new FakeStorageRpc(throwIfOptions);
+ }
+ })
+ .build();
+ }
+
+}
diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java
index 8afdd8a9660d..2ea1866f2966 100644
--- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java
+++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/testing/package-info.java
@@ -15,7 +15,9 @@
*/
/**
- * A testing helper for Google Cloud Storage.
+ * Two testing helpers for Google Cloud Storage.
+ *
+ * RemoteGcsHelper helps with testing on the actual cloud.
*
* A simple usage example:
*
@@ -32,6 +34,21 @@
* RemoteGcsHelper.forceDelete(storage, bucket, 5, TimeUnit.SECONDS);
* }
*
+ * LocalGcsHelper helps with testing on an in-memory filesystem (this is best for unit tests).
+ * Note that this filesystem isn't a complete implementation. In particular, it is not thread-safe.
+ *
+ *
A simple usage example:
+ *
+ *
+ * CloudStorageFileSystemProvider.setGCloudOptions(LocalGcsHelper.options());
+ * Path path = Paths.get(URI.create("gs://bucket/wednesday"));
+ * thrown.expect(NoSuchFileException.class);
+ * Files.newByteChannel(path);
+ *
+ *
+ * The first line ensures that the test uses the in-memory GCS instead of the real one
+ * (note that you have to set the cloud options before the first usage of the gs:// prefix).
+ *
* @see
* gcloud-java tools for testing
*/