cadonna commented on code in PR #13681: URL: https://github.com/apache/kafka/pull/13681#discussion_r1210581130
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -3137,13 +3102,11 @@ public Set<TopicPartition> changelogPartitions() { } }; - expect(activeTaskCreator.createTasks(anyObject(), eq(assignment))).andStubReturn(singletonList(task00)); - activeTaskCreator.closeAndRemoveTaskProducerIfNeeded(eq(taskId00)); - expectLastCall(); - activeTaskCreator.closeThreadProducerIfNeeded(); - expectLastCall().andThrow(new RuntimeException("whatever")); + when(activeTaskCreator.createTasks(any(), Mockito.eq(assignment))).thenReturn(singletonList(task00)); + doThrow(new RuntimeException("whatever")).when(activeTaskCreator).closeThreadProducerIfNeeded(); expect(standbyTaskCreator.createTasks(eq(emptyMap()))).andStubReturn(emptyList()); - replay(activeTaskCreator, standbyTaskCreator); + expect(standbyTaskCreator.createTasks(eq(emptyMap()))).andStubReturn(emptyList()); Review Comment: I agree with @clolov . ########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -3636,9 +3586,9 @@ public void shouldCommitViaConsumerIfEosDisabled() { @Test public void shouldCommitViaProducerIfEosAlphaEnabled() { final StreamsProducer producer = EasyMock.mock(StreamsProducer.class); - expect(activeTaskCreator.streamsProducerForTask(anyObject(TaskId.class))) - .andReturn(producer) - .andReturn(producer); + when(activeTaskCreator.streamsProducerForTask(any(TaskId.class))) + .thenReturn(producer) + .thenReturn(producer); Review Comment: I agree ########## streams/src/test/java/org/apache/kafka/streams/processor/internals/TaskManagerTest.java: ########## @@ -4448,10 +4396,10 @@ public void shouldNotFailForTimeoutExceptionOnCommitWithEosAlpha() { final TaskManager taskManager = setUpTaskManager(ProcessingMode.EXACTLY_ONCE_ALPHA, tasks, false); final StreamsProducer producer = mock(StreamsProducer.class); - expect(activeTaskCreator.streamsProducerForTask(anyObject(TaskId.class))) - .andReturn(producer) - .andReturn(producer) - .andReturn(producer); + when(activeTaskCreator.streamsProducerForTask(any(TaskId.class))) + .thenReturn(producer) + .thenReturn(producer) Review Comment: I agree -- 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