dplavcic commented on code in PR #12449:
URL: https://github.com/apache/kafka/pull/12449#discussion_r936038290
##########
streams/src/test/java/org/apache/kafka/streams/processor/internals/metrics/StreamsMetricsImplTest.java:
##########
@@ -1293,43 +1259,42 @@ 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);
final Time time = mock(Time.class);
- expect(time.nanoseconds()).andReturn(startTime);
- expect(time.nanoseconds()).andReturn(endTime);
- replay(sensor, time);
+ when(time.nanoseconds())
+ .thenReturn(startTime)
+ .thenReturn(endTime);
Review Comment:
First `time.nanoseconds()` invocation will return `startTime` value. All
other `time.nanoseconds()` method invocations will return `endTime` value.
--
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]