DefaultStandbyBlobReader implements StandbyBlobReader { @Override public long getBlobLength(String blobId) { if (store == null) { return -1L; } try { return store.getBlobLength(blobId); } catch (IOException e) { log.warn("Error while reading blob content", e); } return -1L; } DefaultStandbyBlobReader(BlobStore store); @Override InputStream readBlob(String blobId); @Override long getBlobLength(String blobId);  }
@Test public void shouldReturnNegativeLengthIfBlobIsUnreadable() throws Exception { BlobStore s = mock(BlobStore.class); when(s.getBlobLength("id")).thenReturn(-1L); DefaultStandbyBlobReader r = new DefaultStandbyBlobReader(s); assertEquals(-1L, r.getBlobLength("id")); }