lct45 commented on a change in pull request #9614: URL: https://github.com/apache/kafka/pull/9614#discussion_r533585639
########## File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImplTest.java ########## @@ -629,16 +657,18 @@ private void setupRemoveSensorsTest(final Metrics metrics, } @Test - public void shouldRemoveClientLevelMetrics() { + public void shouldRemoveClientLevelMetricsAndSensors() { final Metrics metrics = niceMock(Metrics.class); final StreamsMetricsImpl streamsMetrics = new StreamsMetricsImpl(metrics, CLIENT_ID, VERSION, time); - addSensorsOnAllLevels(metrics, streamsMetrics); + final Capture<String> sensorKeys = addSensorsOnAllLevels(metrics, streamsMetrics); resetToDefault(metrics); - expect(metrics.removeMetric(metricName1)).andStubReturn(null); - expect(metrics.removeMetric(metricName2)).andStubReturn(null); - replay(metrics); - streamsMetrics.removeAllClientLevelMetrics(); + metrics.removeSensor(sensorKeys.getValues().get(0)); + metrics.removeSensor(sensorKeys.getValues().get(1)); + expect(metrics.removeMetric(metricName1)).andReturn(mock(KafkaMetric.class)); + expect(metrics.removeMetric(metricName2)).andReturn(mock(KafkaMetric.class)); Review comment: Must've been an accidental change when trying to get the test to work. `shouldRemoveStateStoreLevelSensors` uses `andReturn(mock(KafkaMetric.class))` so that's where it came from, but this test works with `andStubReturn(null)` so I changed it back to that ---------------------------------------------------------------- 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