clolov commented on code in PR #14623:
URL: https://github.com/apache/kafka/pull/14623#discussion_r1373087790


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImplTest.java:
##########
@@ -1293,43 +1204,33 @@ private void verifyMetric(final String name,
     public void shouldMeasureLatency() {
         final long startTime = 6;
         final long endTime = 10;
-        final Sensor sensor = createMock(Sensor.class);
-        expect(sensor.shouldRecord()).andReturn(true);
-        expect(sensor.hasMetrics()).andReturn(true);
-        sensor.record(endTime - startTime);
+        final Sensor sensor = mock(Sensor.class);
+        when(sensor.shouldRecord()).thenReturn(true);
+        when(sensor.hasMetrics()).thenReturn(true);
+        doNothing().when(sensor).record(endTime - startTime);

Review Comment:
   If I add `doNothing().when(sensor).checkQuotas();` in this test I get the 
following error when running the whole test suite:
   ```
   org.mockito.exceptions.misusing.UnnecessaryStubbingException: 
   Unnecessary stubbings detected in test class: StreamsMetricsImplTest
   Clean & maintainable test code requires zero unnecessary code.
   Following stubbings are unnecessary (click to navigate to relevant line of 
code):
     1. -> at 
org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImplTest.shouldMeasureLatency(StreamsMetricsImplTest.java:1209)
   ```
   As such, I believe this means that the verification is carried out on these 
stubs as well.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to