AbstractBinaryStore implements BinaryStore { @Override public boolean hasBinary( BinaryKey key ) { try { InputStream is = getInputStream(key); is.close(); } catch (BinaryStoreException e) { return false; } catch (IOException e) { return false; } return true; }  static int bestBufferSize( long fileSize ); @Override long getMinimumBinarySizeInBytes(); @Override void setMinimumBinarySizeInBytes( long minSizeInBytes ); @Override void setTextExtractors( TextExtractors textExtractors ); @Override void setMimeTypeDetector( MimeTypeDetector mimeTypeDetector ); @Override final String getText( BinaryValue binary ); @Override String getMimeType( BinaryValue binary,
                               String name ); @Override boolean hasBinary( BinaryKey key ); abstract void storeExtractedText( BinaryValue source,
                                             String extractedText ); abstract String getExtractedText( BinaryValue source ); @Override BinaryValue storeValue( InputStream stream, String hint, boolean markAsUnused ); @Override void start(); @Override void shutdown();  }
@Test public void shouldHaveKey() throws BinaryStoreException, IOException { storeAndValidate(STORED_MEDIUM_KEY, STORED_MEDIUM_BINARY); assertTrue("Expected BinaryStore to contain the key", getBinaryStore().hasBinary(STORED_MEDIUM_KEY)); }
@Test public void shouldNotHaveKey() { assertTrue("Did not expect BinaryStore to contain the key", !getBinaryStore().hasBinary(invalidBinaryKey())); }