ZookeeperCounterStorage implements CounterStorage { @Override public long getTopicPublishedCounter(TopicName topicName) { return sharedCounter.getValue(topicPublishedCounter(topicName)); } @Inject  ZookeeperCounterStorage(SharedCounter sharedCounter,
                                   SubscriptionRepository subscriptionRepository,
                                   PathsCompiler pathsCompiler,
                                   ConfigFactory configFactory); @Override void setTopicPublishedCounter(TopicName topicName, long count); @Override long getTopicPublishedCounter(TopicName topicName); @Override long getSubscriptionDeliveredCounter(TopicName topicName, String subscriptionName); @Override void setSubscriptionDeliveredCounter(TopicName topicName, String subscriptionName, long count); @Override void setSubscriptionDiscardedCounter(TopicName topicName, String subscriptionName, long count); @Override void incrementVolumeCounter(TopicName topicName, String subscriptionName, long value); @Override void incrementVolumeCounter(TopicName topicName, long value);  }
@Test public void shouldReadValueFromTopicMetric() { when(sharedCounter.getValue("/hermes/groups/test/topics/topic/metrics/published")).thenReturn(10L); long value = storage.getTopicPublishedCounter(TopicName.fromQualifiedName("test.topic")); assertThat(value).isEqualTo(10); }