1717package org .springframework .kafka .annotation ;
1818
1919import static org .assertj .core .api .Assertions .assertThat ;
20- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
20+ import static org .assertj .core .api .Assertions .assertThatIllegalArgumentException ;
2121import static org .mockito .ArgumentMatchers .any ;
2222import static org .mockito .ArgumentMatchers .anyMap ;
2323import static org .mockito .ArgumentMatchers .anyString ;
@@ -257,7 +257,7 @@ public void testSimple() throws Exception {
257257 "listenerConsumer.consumer" ));
258258 assertThat (
259259 KafkaTestUtils .getPropertyValue (this .listener .listen4Consumer , "fetcher.maxPollRecords" , Integer .class ))
260- .isEqualTo (100 );
260+ .isEqualTo (100 );
261261 assertThat (this .quxGroup ).hasSize (1 );
262262 assertThat (this .quxGroup .get (0 )).isSameAs (manualContainer );
263263 List <?> containers = KafkaTestUtils .getPropertyValue (manualContainer , "containers" , List .class );
@@ -311,14 +311,12 @@ public void testSimple() throws Exception {
311311 .isNotEqualTo ("rebalanceListener" );
312312 String clientId = KafkaTestUtils .getPropertyValue (rebalanceContainer , "listenerConsumer.consumer.clientId" ,
313313 String .class );
314- assertThat (
315- clientId )
316- .startsWith ("rebal-" );
314+ assertThat (clientId ).startsWith ("rebal-" );
317315 assertThat (clientId .indexOf ('-' )).isEqualTo (clientId .lastIndexOf ('-' ));
318316 }
319317
320318 @ Test
321- public void testAutoStartup () throws Exception {
319+ public void testAutoStartup () {
322320 MessageListenerContainer listenerContainer = registry .getListenerContainer ("manualStart" );
323321 assertThat (listenerContainer ).isNotNull ();
324322 assertThat (listenerContainer .isRunning ()).isFalse ();
@@ -401,7 +399,6 @@ public void testJson() throws Exception {
401399 }
402400
403401 @ Test
404- @ DirtiesContext
405402 public void testJsonHeaders () throws Exception {
406403 ConcurrentMessageListenerContainer <?, ?> container =
407404 (ConcurrentMessageListenerContainer <?, ?>) registry .getListenerContainer ("jsonHeaders" );
@@ -549,7 +546,7 @@ public void testValidation() throws Exception {
549546 }
550547
551548 @ Test
552- public void testReplyingListener () throws Exception {
549+ public void testReplyingListener () {
553550 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
554551 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testReplying" );
555552 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -563,7 +560,7 @@ public void testReplyingListener() throws Exception {
563560 }
564561
565562 @ Test
566- public void testReplyingBatchListener () throws Exception {
563+ public void testReplyingBatchListener () {
567564 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
568565 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testBatchReplying" );
569566 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -589,7 +586,7 @@ public void testReplyingBatchListener() throws Exception {
589586 }
590587
591588 @ Test
592- public void testReplyingListenerWithErrorHandler () throws Exception {
589+ public void testReplyingListenerWithErrorHandler () {
593590 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
594591 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testErrorHandlerReplying" );
595592 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -603,7 +600,7 @@ public void testReplyingListenerWithErrorHandler() throws Exception {
603600 }
604601
605602 @ Test
606- public void testVoidListenerWithReplyingErrorHandler () throws Exception {
603+ public void testVoidListenerWithReplyingErrorHandler () {
607604 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
608605 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testVoidWithErrorHandlerReplying" );
609606 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -617,7 +614,7 @@ public void testVoidListenerWithReplyingErrorHandler() throws Exception {
617614 }
618615
619616 @ Test
620- public void testReplyingBatchListenerWithErrorHandler () throws Exception {
617+ public void testReplyingBatchListenerWithErrorHandler () {
621618 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
622619 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testErrorHandlerBatchReplying" );
623620 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -643,7 +640,7 @@ public void testReplyingBatchListenerWithErrorHandler() throws Exception {
643640 }
644641
645642 @ Test
646- public void testMultiReplyTo () throws Exception {
643+ public void testMultiReplyTo () {
647644 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
648645 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testMultiReplying" );
649646 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -712,10 +709,12 @@ public void testAddingTopics() {
712709 assertThat (embeddedKafka .getTopics ().size ()).isEqualTo (count + 1 );
713710 embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 ));
714711 assertThat (embeddedKafka .getTopics ().size ()).isEqualTo (count + 2 );
715- assertThatThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 )))
716- .isInstanceOf (IllegalArgumentException .class ).hasMessageContaining ("exists" );
717- assertThatThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions2" , 10 , (short ) 2 )))
718- .isInstanceOf (IllegalArgumentException .class ).hasMessageContaining ("replication" );
712+ assertThatIllegalArgumentException ()
713+ .isThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 )))
714+ .withMessageContaining ("exists" );
715+ assertThatIllegalArgumentException ()
716+ .isThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions2" , 10 , (short ) 2 )))
717+ .withMessageContaining ("replication" );
719718 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
720719 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testMultiReplying" );
721720 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -736,7 +735,7 @@ public void testReceivePollResults() throws Exception {
736735 @ Test
737736 public void testAutoConfigTm () {
738737 assertThat (this .transactionalFactory .getContainerProperties ().getTransactionManager ())
739- .isInstanceOf (ChainedKafkaTransactionManager .class );
738+ .isInstanceOf (ChainedKafkaTransactionManager .class );
740739 }
741740
742741 @ Test
@@ -1424,8 +1423,9 @@ public void listen3(ConsumerRecord<?, ?> record) {
14241423 this .latch3 .countDown ();
14251424 }
14261425
1427- @ KafkaListener (id = "qux" , topics = "annotated4" , containerFactory = "kafkaManualAckListenerContainerFactory" ,
1428- containerGroup = "qux#{'Group'}" , properties = {
1426+ @ KafkaListener (id = "#{'qux'}" , topics = "annotated4" ,
1427+ containerFactory = "kafkaManualAckListenerContainerFactory" , containerGroup = "qux#{'Group'}" ,
1428+ properties = {
14291429 "max.poll.interval.ms:#{'${poll.interval:60000}'}" ,
14301430 ConsumerConfig .MAX_POLL_RECORDS_CONFIG + "=#{'${poll.recs:100}'}"
14311431 })
@@ -1888,6 +1888,7 @@ public void setDelegate(
18881888 public Foo convert (String source ) {
18891889 return delegate .convert (source );
18901890 }
1891+
18911892 }
18921893
18931894 public static class ValidatedClass {
0 commit comments