[
https://issues.apache.org/jira/browse/KAFKA-8977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16945729#comment-16945729
]
Bruno Cadonna commented on KAFKA-8977:
--------------------------------------
Thank you for picking this up.
IMO we should mock {{StreamsMetricsImpl}} in the test where we do not directly
test {{StreamsMetricsImpl}}. However, there is no need to write a mock. I would
use {{EasyMock}} or {{PowerMock}} to mock {{StreamsMetricsImpl}}. You would use
{{EasyMock}} if only instance methods need to be mocked and {{PowerMock}} if
class methods or final methods need to be mocked. You can find an example of
both types of mocks for {{StreamsMetricsImpl}} in {{NamedCacheMetricsTest}}.
> Remove MockStreamsMetrics Since it is not a Mock
> ------------------------------------------------
>
> Key: KAFKA-8977
> URL: https://issues.apache.org/jira/browse/KAFKA-8977
> Project: Kafka
> Issue Type: Improvement
> Components: streams
> Reporter: Bruno Cadonna
> Assignee: bibin sebastian
> Priority: Minor
> Labels: newbie
>
> The class {{MockStreamsMetrics}} is used throughout unit tests as a mock but
> it is not really a mock since it only hides two parameters of the
> {{StreamsMetricsImpl}} constructor. Either a real mock or the real
> {{StreamsMetricsImpl}} should be used in the tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)