S3BinaryStore extends AbstractBinaryStore { @Override protected String getStoredMimeType(BinaryValue binaryValue) throws BinaryStoreException { try { return Optional.of(s3Client.getObjectMetadata(bucketName, binaryValue.getKey().toString())) .filter(m -> Boolean.parseBoolean(m.getUserMetadata().get(USER_MIME_TYPE_KEY))) .map(ObjectMetadata::getContentType) .orElse(null); } catch (AmazonClientException e) { throw new BinaryStoreException(e); } } S3BinaryStore(String accessKey, String secretKey, String bucketName);  S3BinaryStore(String accessKey, String secretKey, String bucketName, String endPoint);  S3BinaryStore( String accessKey,
                          String secretKey,
                          String bucketName,
                          String endPoint,
                          Boolean deleteUnusedNatively ); protected  S3BinaryStore(String bucketName, AmazonS3 s3Client, boolean deleteUnusedNatively); @Override void storeExtractedText(BinaryValue binaryValue, String extractedText); @Override String getExtractedText(BinaryValue binaryValue); @Override BinaryValue storeValue(InputStream stream, boolean markAsUnused); @Override InputStream getInputStream(BinaryKey key); @Override void markAsUsed(Iterable<BinaryKey> keys); @Override void markAsUnused(Iterable<BinaryKey> keys); @Override void removeValuesUnusedLongerThan(long minimumAge, TimeUnit timeUnit); @Override Iterable<BinaryKey> getAllBinaryKeys(); void migrateUnusedMetadataToTags();  }
@Test public void testGetStoredMimeType() throws BinaryStoreException { ObjectMetadata objMeta = new ObjectMetadata(); objMeta.setContentType(TEST_MIME); objMeta.addUserMetadata(S3BinaryStore.USER_MIME_TYPE_KEY, String.valueOf(true)); expect(s3Client.getObjectMetadata(BUCKET, TEST_KEY)).andReturn(objMeta); replayAll(); BinaryValue binaryValue = createBinaryValue(TEST_KEY, TEST_CONTENT); String mimeType = s3BinaryStore.getStoredMimeType(binaryValue); assertEquals(TEST_MIME, mimeType); }