DefaultStandbyBlobReader implements StandbyBlobReader { @Override public InputStream readBlob(String blobId) { if (store == null) { return null; } try { return store.getInputStream(blobId); } catch (IOException e) { log.warn("Error while reading blob content", e); } return null; } DefaultStandbyBlobReader(BlobStore store); @Override InputStream readBlob(String blobId); @Override long getBlobLength(String blobId);  }
@Test public void shouldAlwaysReturnNullWithoutBlobStore() throws Exception { DefaultStandbyBlobReader r = new DefaultStandbyBlobReader(null); assertNull(r.readBlob("id")); }
@Test public void shouldReturnNullIfBlobDoesNotExist() throws Exception { BlobStore s = mock(BlobStore.class); when(s.getInputStream("id")).thenThrow(new IOException("blob not found")); DefaultStandbyBlobReader r = new DefaultStandbyBlobReader(s); assertNull(r.readBlob("id")); }