vvcephei commented on a change in pull request #8902: URL: https://github.com/apache/kafka/pull/8902#discussion_r446471736
########## 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: Thanks, all. What Sophie mentioned is more in line with what I had in mind. The advantage of something like "MIPC" is that it just generally satisfies the API contract while not really doing stuff like writing to the brokers, etc. Because it's a contract-valid implementation of InternalProcessorContext, we can use it transparently to support any use case where we really don't care exactly what calls the unit under test makes into the context. EasyMock is very powerful, but it can't magically implement a complex interface contract, so it can never fill this gap. On the other hand, if there's really only going to be one or two calls, then it's fine. And, of course, if we _need_ to verify interactions, exceptions, etc., then EasyMock gives us a very powerful set of utilities for it. Anyway, we don't have to change this right now, but I've certainly spent many hours fiddling around with easymock expectations just like this, and it provides no value if you just want the thing to behave the way that MIPC already behaves. Which is why I pointed it out. ---------------------------------------------------------------- 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: us...@infra.apache.org