Igor Stepanov created KAFKA-3923: ------------------------------------ Summary: MetricReporter interface depends on final class KafkaMetric instead of Metric interface Key: KAFKA-3923 URL: https://issues.apache.org/jira/browse/KAFKA-3923 Project: Kafka Issue Type: Improvement Components: clients Reporter: Igor Stepanov
Hello, I'm working on exposing Kafka's consumer/producer metrics to Spring Actuator. To achieve this, I've implemented Kafka's MetricReporter interface to allow injecting it into the appropriate consumer/producer. No issues with implementation itself, fine for me. But now I've moved to writing unit tests for this implementation and decided to use mocked KafkaMetric instances for this. But mocking of KafkaMetric itself is not so plain - the class is final. The logical step is to use Metric interface for mocking, but MetricReporter accepts only KafkaMetric. I know that technically I can use PowerMock and most probably it will work fine in this case, but talking about Kafka itself, is it a good approach to depend on the exact implementation when interface fulfils most of the needs? -- This message was sent by Atlassian JIRA (v6.3.4#6332)