1919import static org .assertj .core .api .Assertions .assertThat ;
2020import static org .mockito .ArgumentMatchers .any ;
2121import static org .mockito .ArgumentMatchers .anyMap ;
22+ import static org .mockito .ArgumentMatchers .anyString ;
2223import static org .mockito .ArgumentMatchers .eq ;
2324import static org .mockito .ArgumentMatchers .isNull ;
2425import static org .mockito .BDDMockito .given ;
2526import static org .mockito .BDDMockito .willAnswer ;
2627import static org .mockito .Mockito .inOrder ;
2728import static org .mockito .Mockito .mock ;
28- import static org .mockito .Mockito .withSettings ;
2929
3030import java .time .Duration ;
3131import java .util .ArrayList ;
@@ -113,11 +113,11 @@ public void discardRemainingRecordsFromPollAndSeek() throws Exception {
113113 HashMap <TopicPartition , OffsetAndMetadata > commit2 = new HashMap <>();
114114 commit2 .put (new TopicPartition ("foo" , 1 ), new OffsetAndMetadata (2L ));
115115 commit2 .put (new TopicPartition ("foo" , 2 ), new OffsetAndMetadata (2L ));
116- inOrder .verify (this .producer ).sendOffsetsToTransaction (eq (commit1 ), any ( ConsumerGroupMetadata . class ));
116+ inOrder .verify (this .producer ).sendOffsetsToTransaction (eq (commit1 ), anyString ( ));
117117 inOrder .verify (this .consumer ).seek (new TopicPartition ("foo" , 1 ), 1L );
118118 inOrder .verify (this .consumer ).seek (new TopicPartition ("foo" , 2 ), 0L );
119119 inOrder .verify (this .consumer ).poll (Duration .ofMillis (ContainerProperties .DEFAULT_POLL_TIMEOUT ));
120- inOrder .verify (this .producer ).sendOffsetsToTransaction (eq (commit2 ), any ( ConsumerGroupMetadata . class ));
120+ inOrder .verify (this .producer ).sendOffsetsToTransaction (eq (commit2 ), anyString ( ));
121121 assertThat (this .config .count ).isEqualTo (2 );
122122 assertThat (this .config .contents .toString ()).isEqualTo ("[[foo, bar, baz, qux, fiz, buz], [qux, fiz, buz]]" );
123123 }
@@ -219,18 +219,18 @@ public Consumer consumer() {
219219 @ SuppressWarnings ({ "rawtypes" , "unchecked" })
220220 @ Bean
221221 Producer producer () {
222- Producer producer = mock (Producer .class , withSettings (). verboseLogging () );
222+ Producer producer = mock (Producer .class );
223223 willAnswer (inv -> {
224224 this .commitLatch .countDown ();
225225 return null ;
226- }).given (producer ).sendOffsetsToTransaction (any (), any ( ConsumerGroupMetadata . class ));
226+ }).given (producer ).sendOffsetsToTransaction (any (), anyString ( ));
227227 return producer ;
228228 }
229229
230230 @ SuppressWarnings ("rawtypes" )
231231 @ Bean
232232 ProducerFactory pf () {
233- ProducerFactory pf = mock (ProducerFactory .class , withSettings (). verboseLogging () );
233+ ProducerFactory pf = mock (ProducerFactory .class );
234234 given (pf .createProducer (isNull ())).willReturn (producer ());
235235 given (pf .transactionCapable ()).willReturn (true );
236236 return pf ;
@@ -251,6 +251,7 @@ public ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory() {
251251 factory .getContainerProperties ().setAckMode (AckMode .MANUAL );
252252 factory .getContainerProperties ().setMissingTopicsFatal (false );
253253 factory .getContainerProperties ().setTransactionManager (tm ());
254+ factory .getContainerProperties ().setSubBatchPerPartition (false );
254255 factory .setBatchListener (true );
255256 return factory ;
256257 }
0 commit comments