[ 
https://issues.apache.org/jira/browse/KAFKA-5676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16109435#comment-16109435
 ] 

Guozhang Wang commented on KAFKA-5676:
--------------------------------------

If you take a look at all unit test classes that uses, {{MockStreamMetrics}} 
you'll see that they need to pass a dummy {{Metrics}} object into the 
{{MockStreamMetrics}} which is quite awkward. Ideally users should just create 
a {{MockStreamMetrics}} object with a no-parameter constructor, and the mock 
will just record how many times its public APIs get called etc, i.e. "mocking 
the behavior" so that the class directly implement the {{StreamMetrics}} 
interface, instead of extending the real implementation {{StreamsMetricsImpl}}, 
which introduces lots of dependencies and issues.

> MockStreamsMetrics should be in o.a.k.test
> ------------------------------------------
>
>                 Key: KAFKA-5676
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5676
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Guozhang Wang
>            Assignee: Chanchal Singh
>              Labels: newbie
>
> {{MockStreamsMetrics}}'s package should be `o.a.k.test` not 
> `o.a.k.streams.processor.internals`. 
> In addition, it should not require a {{Metrics}} parameter in its constructor 
> as it is only needed for its extended base class; the right way of mocking 
> should be implementing {{StreamsMetrics}} with mock behavior than extended a 
> real implementaion of {{StreamsMetricsImpl}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to