Skip to content

Commit

Permalink
Merge pull request #256 from mziccard/blob-exists-options
Browse files Browse the repository at this point in the history
Add options parameter to Blob.exists
  • Loading branch information
aozarov committed Oct 14, 2015
2 parents 5e1d71b + 77a9dd1 commit 7115734
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 7115734

Please sign in to comment.