Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down