dplavcic commented on code in PR #12449:
URL: https://github.com/apache/kafka/pull/12449#discussion_r937067118


##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImplTest.java:
##########
@@ -287,7 +279,7 @@ public void shouldGetExistingThreadLevelSensor() {
 
         final Sensor actualSensor = 
streamsMetrics.threadLevelSensor(THREAD_ID1, SENSOR_NAME_1, recordingLevel);
 
-        verify(metrics);
+        verify(metrics).getSensor("internal.test-thread-1.s.sensor1");

Review Comment:
   `shouldGetExistingThreadLevelSensor` test invokes 
`setupGetExistingSensorTest(metrics)` which does the following:
   ```java
       private void setupGetExistingSensorTest(final Metrics metrics) {
           when(metrics.getSensor(anyString())).thenReturn(sensor);
       }
   ```
   
   An explicit verify is added to be sure `metrics.getSensor()` is invoked with 
the exact string, and not `anyString()` as stated in stub in 
`setupGetExistingSensorTest` method.
   
   The same reasoning applies to other explicit 
`verify(metrics).getSensor(...)` calls.



##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImplTest.java:
##########
@@ -305,7 +297,6 @@ public void shouldGetNewTaskLevelSensor() {
             recordingLevel
         );
 
-        verify(metrics);

Review Comment:
   `shouldGetNewTaskLevelSensor` invokes `setupGetNewSensorTest` which 
internally creates a stub with exact values, providing implicit verify.



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