diff --git a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java index c3958b7a69a9..4e5045d65052 100644 --- a/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java +++ b/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java @@ -150,11 +150,12 @@ public BlobId id() { /** * Checks if this blob exists. * + * @param options blob read options * @return true if this blob exists, false otherwise * @throws StorageException upon failure */ - public boolean exists() { - return storage.get(info.blobId()) != null; + public boolean exists(BlobSourceOption... options) { + return storage.get(info.blobId(), convert(info, options)) != null; } /** diff --git a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java index 59bae16886a5..e60c1178c43d 100644 --- a/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java +++ b/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java @@ -70,14 +70,14 @@ public void testInfo() throws Exception { @Test public void testExists_True() throws Exception { - expect(storage.get(BLOB_INFO.blobId())).andReturn(BLOB_INFO); + expect(storage.get(BLOB_INFO.blobId(), new Storage.BlobSourceOption[0])).andReturn(BLOB_INFO); replay(storage); assertTrue(blob.exists()); } @Test public void testExists_False() throws Exception { - expect(storage.get(BLOB_INFO.blobId())).andReturn(null); + expect(storage.get(BLOB_INFO.blobId(), new Storage.BlobSourceOption[0])).andReturn(null); replay(storage); assertFalse(blob.exists()); }