bachmanity1 commented on code in PR #14410: URL: https://github.com/apache/kafka/pull/14410#discussion_r1368465903
########## streams/src/test/java/org/apache/kafka/streams/state/internals/GlobalStateStoreProviderTest.java: ########## @@ -105,28 +105,19 @@ public void before() { Serdes.String(), Serdes.String()).build()); - final ProcessorContextImpl mockContext = niceMock(ProcessorContextImpl.class); - expect(mockContext.applicationId()).andStubReturn("appId"); - expect(mockContext.metrics()) - .andStubReturn( + final ProcessorContextImpl mockContext = mock(ProcessorContextImpl.class); + when(mockContext.applicationId()).thenReturn("appId"); + when(mockContext.metrics()) + .thenReturn( new StreamsMetricsImpl(new Metrics(), "threadName", StreamsConfig.METRICS_LATEST, new MockTime()) ); - expect(mockContext.taskId()).andStubReturn(new TaskId(0, 0)); - expect(mockContext.recordCollector()).andStubReturn(null); Review Comment: I haven't stubbed `mockContext.recordCollector()` method because it's never actually called. `andStubReturn` method of EasyMock doesn't verify that the method is actually called it only provides a default return value without enforcing strict behavior. Replacing `andStubReturn` with `andReturn` makes tests fail as shown below. (To verify this you have to convert `mockContext` variable to class field and call `verify(mockContext) after each test). ![image](https://github.com/apache/kafka/assets/81428651/92e3cbe0-370f-4937-86a1-5e4353ec5f73) -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org