cadonna commented on a change in pull request #8902:
URL: https://github.com/apache/kafka/pull/8902#discussion_r446050025
##########
File path:
streams/src/test/java/org/apache/kafka/streams/state/internals/MeteredKeyValueStoreTest.java
##########
@@ -124,18 +141,19 @@ public void before() {
Serdes.String()
);
metrics.config().recordLevel(Sensor.RecordingLevel.DEBUG);
- expect(context.metrics())
- .andReturn(new StreamsMetricsImpl(metrics, "test",
builtInMetricsVersion)).anyTimes();
- expect(context.taskId()).andReturn(taskId).anyTimes();
- expect(inner.name()).andReturn("metered").anyTimes();
+ expect(context.applicationId()).andStubReturn(APPLICATION_ID);
+ expect(context.metrics()).andStubReturn(new
StreamsMetricsImpl(metrics, "test", builtInMetricsVersion));
+ expect(context.taskId()).andStubReturn(taskId);
+
expect(context.changelogFor(STORE_NAME)).andStubReturn(CHANGELOG_TOPIC);
Review comment:
I guess there is a misunderstanding. You cannot verify an expectation
that is specified with `andStubReturn()`. That is the reason why I changed
`andReturn().anyTimes()` with `andStubReturn()`. This also means that these
expectations do not depend on the implementation details (i.e. how often the
methods are called). The combination of nice mock with `andStubReturn()` has
similar effect as using `MockInternalProcessorContext`. Refactoring the tests
would unreasonably increase this PR. Hence, I would like not to do it in this
PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]