mdedetrich commented on code in PR #12524: URL: https://github.com/apache/kafka/pull/12524#discussion_r975440743
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/StandbyTaskTest.java: ########## @@ -313,36 +282,29 @@ public void shouldNotFlushAndThrowOnCloseDirty() { final double expectedCloseTaskMetric = 1.0; verifyCloseTaskMetric(expectedCloseTaskMetric, streamsMetrics, metricName); - - EasyMock.verify(stateManager); } @Test public void shouldNotThrowFromStateManagerCloseInCloseDirty() { - EasyMock.expect(stateManager.changelogOffsets()).andStubReturn(Collections.emptyMap()); - stateManager.close(); - EasyMock.expectLastCall().andThrow(new RuntimeException("KABOOM!")).anyTimes(); - EasyMock.replay(stateManager); + doThrow(new RuntimeException("KABOOM!")).when(stateManager).close(); task = createStandbyTask(); task.initializeIfNeeded(); task.suspend(); task.closeDirty(); - EasyMock.verify(stateManager); + verify(stateManager, atLeastOnce()).close(); } @Test public void shouldSuspendAndCommitBeforeCloseClean() { stateManager.close(); - EasyMock.expectLastCall(); + verify(stateManager, atLeastOnce()).close(); stateManager.checkpoint(); - EasyMock.expectLastCall().once(); - EasyMock.expect(stateManager.changelogOffsets()) - .andReturn(Collections.singletonMap(partition, 60L)); - EasyMock.expect(stateManager.changelogPartitions()).andReturn(Collections.singleton(partition)).anyTimes(); Review Comment: This was another case where I didn't know what `EasyMock.verify(stateManager)` at the end of the method was actually verifying. I placed ```java when(stateManager.changelogOffsets()) .thenReturn(Collections.singletonMap(partition, 60L)); ``` back and verified `verify(stateManager).changelogOffsets();`. Note that mockito reported ```java when(stateManager.changelogPartitions()) .thenReturn(Collections.singleton(partition)); ``` as unnecessary due to `verify(stateManager).changelogPartitions()` never actually being called. -- 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