cadonna commented on code in PR #12524: URL: https://github.com/apache/kafka/pull/12524#discussion_r976311215
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/ProcessorStateManagerTest.java: ########## @@ -310,48 +301,30 @@ public void shouldRestoreTimestampedStoreWithConverter() { @Test public void shouldUnregisterChangelogsDuringClose() { final ProcessorStateManager stateMgr = getStateManager(Task.TaskType.ACTIVE); - reset(storeMetadata); - final StateStore store = EasyMock.createMock(StateStore.class); - expect(storeMetadata.changelogPartition()).andStubReturn(persistentStorePartition); - expect(storeMetadata.store()).andStubReturn(store); - expect(store.name()).andStubReturn(persistentStoreName); - - context.uninitialize(); - store.init((StateStoreContext) context, store); - replay(storeMetadata, context, store); + final StateStore store = mock(StateStore.class); + when(store.name()).thenReturn(persistentStoreName); stateMgr.registerStateStores(singletonList(store), context); - verify(context, store); + verify(context).uninitialize(); + verify(store).init((StateStoreContext) context, store); stateMgr.registerStore(store, noopStateRestoreCallback, null); assertTrue(changelogReader.isPartitionRegistered(persistentStorePartition)); - reset(store); - expect(store.name()).andStubReturn(persistentStoreName); - store.close(); Review Comment: I think we are misunderstanding each other. With after line 314, I meant after `stateMgr.close();`. It could be that I mixed up the line number. Currently the test does not pass (as you can see in the builds) because the verification `verify(store).close();` is before `stateMgr.close();`. The test should look like this: ``` public void shouldUnregisterChangelogsDuringClose() { final ProcessorStateManager stateMgr = getStateManager(Task.TaskType.ACTIVE); final StateStore store = mock(StateStore.class); when(store.name()).thenReturn(persistentStoreName); stateMgr.registerStateStores(singletonList(store), context); verify(context).uninitialize(); verify(store).init((StateStoreContext) context, store); stateMgr.registerStore(store, noopStateRestoreCallback, null); assertTrue(changelogReader.isPartitionRegistered(persistentStorePartition)); stateMgr.close(); verify(store).close(); assertFalse(changelogReader.isPartitionRegistered(persistentStorePartition)); } ``` -- 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