clolov commented on code in PR #14410: URL: https://github.com/apache/kafka/pull/14410#discussion_r1366895932
########## streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamsProducerTest.java: ########## @@ -1098,20 +1055,16 @@ public void shouldSwallowExceptionOnEosAbortTxInvalidEpoch() { } private void testSwallowExceptionOnEosAbortTx(final RuntimeException exception) { - mockedProducer.initTransactions(); - mockedProducer.beginTransaction(); - expect(mockedProducer.send(record, null)).andReturn(null); - mockedProducer.abortTransaction(); - expectLastCall().andThrow(exception); - replay(mockedProducer); + doReturn(null).when(mockedProducer).send(record, null); Review Comment: For consistency: ```suggestion when(mockedProducer).send(record, null).thenReturn(null); ``` ########## 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: As far as I know the default return value of mocks is null when the return an object. For validation's sake, however, you are right. You either need to when this or verify this. -- 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