BlobStoreDeletedMessageVault implements DeletedMessageVault { @Override public Publisher<Void> append(DeletedMessage deletedMessage, InputStream mimeMessage) { Preconditions.checkNotNull(deletedMessage); Preconditions.checkNotNull(mimeMessage); BucketName bucketName = nameGenerator.currentBucket(); return metricFactory.decoratePublisherWithTimerMetric( APPEND_METRIC_NAME, appendMessage(deletedMessage, mimeMessage, bucketName)); } @Inject  BlobStoreDeletedMessageVault(MetricFactory metricFactory, DeletedMessageMetadataVault messageMetadataVault,
                                        BlobStore blobStore, BlobStoreDAO blobStoreDAO, BucketNameGenerator nameGenerator,
                                        Clock clock,
                                        RetentionConfiguration retentionConfiguration); @Override Publisher<Void> append(DeletedMessage deletedMessage, InputStream mimeMessage); @Override Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId); @Override Publisher<DeletedMessage> search(Username username, Query query); @Override Publisher<Void> delete(Username username, MessageId messageId); @Override Task deleteExpiredMessagesTask();  }
@Test void appendShouldPublishAppendTimerMetrics() { Mono.from(messageVault.append(DELETED_MESSAGE, new ByteArrayInputStream(CONTENT))) .block(); Mono.from(messageVault.append(DELETED_MESSAGE_2, new ByteArrayInputStream(CONTENT))) .block(); assertThat(metricFactory.executionTimesFor(APPEND_METRIC_NAME)) .hasSize(2); }