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 .anyMap ;
2222import static org .mockito .ArgumentMatchers .anyString ;
2323import static org .mockito .ArgumentMatchers .isNull ;
@@ -255,7 +255,7 @@ public void testSimple() throws Exception {
255255 "listenerConsumer.consumer" ));
256256 assertThat (
257257 KafkaTestUtils .getPropertyValue (this .listener .listen4Consumer , "fetcher.maxPollRecords" , Integer .class ))
258- .isEqualTo (100 );
258+ .isEqualTo (100 );
259259 assertThat (this .quxGroup ).hasSize (1 );
260260 assertThat (this .quxGroup .get (0 )).isSameAs (manualContainer );
261261 List <?> containers = KafkaTestUtils .getPropertyValue (manualContainer , "containers" , List .class );
@@ -309,14 +309,12 @@ public void testSimple() throws Exception {
309309 .isNotEqualTo ("rebalanceListener" );
310310 String clientId = KafkaTestUtils .getPropertyValue (rebalanceContainer , "listenerConsumer.consumer.clientId" ,
311311 String .class );
312- assertThat (
313- clientId )
314- .startsWith ("rebal-" );
312+ assertThat (clientId ).startsWith ("rebal-" );
315313 assertThat (clientId .indexOf ('-' )).isEqualTo (clientId .lastIndexOf ('-' ));
316314 }
317315
318316 @ Test
319- public void testAutoStartup () throws Exception {
317+ public void testAutoStartup () {
320318 MessageListenerContainer listenerContainer = registry .getListenerContainer ("manualStart" );
321319 assertThat (listenerContainer ).isNotNull ();
322320 assertThat (listenerContainer .isRunning ()).isFalse ();
@@ -399,7 +397,6 @@ public void testJson() throws Exception {
399397 }
400398
401399 @ Test
402- @ DirtiesContext
403400 public void testJsonHeaders () throws Exception {
404401 ConcurrentMessageListenerContainer <?, ?> container =
405402 (ConcurrentMessageListenerContainer <?, ?>) registry .getListenerContainer ("jsonHeaders" );
@@ -546,7 +543,7 @@ public void testValidation() throws Exception {
546543 }
547544
548545 @ Test
549- public void testReplyingListener () throws Exception {
546+ public void testReplyingListener () {
550547 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
551548 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testReplying" );
552549 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -560,7 +557,7 @@ public void testReplyingListener() throws Exception {
560557 }
561558
562559 @ Test
563- public void testReplyingBatchListener () throws Exception {
560+ public void testReplyingBatchListener () {
564561 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
565562 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testBatchReplying" );
566563 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -586,7 +583,7 @@ public void testReplyingBatchListener() throws Exception {
586583 }
587584
588585 @ Test
589- public void testReplyingListenerWithErrorHandler () throws Exception {
586+ public void testReplyingListenerWithErrorHandler () {
590587 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
591588 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testErrorHandlerReplying" );
592589 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -600,7 +597,7 @@ public void testReplyingListenerWithErrorHandler() throws Exception {
600597 }
601598
602599 @ Test
603- public void testVoidListenerWithReplyingErrorHandler () throws Exception {
600+ public void testVoidListenerWithReplyingErrorHandler () {
604601 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
605602 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testVoidWithErrorHandlerReplying" );
606603 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -614,7 +611,7 @@ public void testVoidListenerWithReplyingErrorHandler() throws Exception {
614611 }
615612
616613 @ Test
617- public void testReplyingBatchListenerWithErrorHandler () throws Exception {
614+ public void testReplyingBatchListenerWithErrorHandler () {
618615 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
619616 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testErrorHandlerBatchReplying" );
620617 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -640,7 +637,7 @@ public void testReplyingBatchListenerWithErrorHandler() throws Exception {
640637 }
641638
642639 @ Test
643- public void testMultiReplyTo () throws Exception {
640+ public void testMultiReplyTo () {
644641 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
645642 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testMultiReplying" );
646643 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -709,10 +706,12 @@ public void testAddingTopics() {
709706 assertThat (embeddedKafka .getTopics ().size ()).isEqualTo (count + 1 );
710707 embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 ));
711708 assertThat (embeddedKafka .getTopics ().size ()).isEqualTo (count + 2 );
712- assertThatThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 )))
713- .isInstanceOf (IllegalArgumentException .class ).hasMessageContaining ("exists" );
714- assertThatThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions2" , 10 , (short ) 2 )))
715- .isInstanceOf (IllegalArgumentException .class ).hasMessageContaining ("replication" );
709+ assertThatIllegalArgumentException ()
710+ .isThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions" , 10 , (short ) 1 )))
711+ .withMessageContaining ("exists" );
712+ assertThatIllegalArgumentException ()
713+ .isThrownBy (() -> embeddedKafka .addTopics (new NewTopic ("morePartitions2" , 10 , (short ) 2 )))
714+ .withMessageContaining ("replication" );
716715 Map <String , Object > consumerProps = new HashMap <>(this .consumerFactory .getConfigurationProperties ());
717716 consumerProps .put (ConsumerConfig .GROUP_ID_CONFIG , "testMultiReplying" );
718717 ConsumerFactory <Integer , String > cf = new DefaultKafkaConsumerFactory <>(consumerProps );
@@ -733,7 +732,7 @@ public void testReceivePollResults() throws Exception {
733732 @ Test
734733 public void testAutoConfigTm () {
735734 assertThat (this .transactionalFactory .getContainerProperties ().getTransactionManager ())
736- .isInstanceOf (ChainedKafkaTransactionManager .class );
735+ .isInstanceOf (ChainedKafkaTransactionManager .class );
737736 }
738737
739738 @ Test
@@ -1416,8 +1415,9 @@ public void listen3(ConsumerRecord<?, ?> record) {
14161415 this .latch3 .countDown ();
14171416 }
14181417
1419- @ KafkaListener (id = "qux" , topics = "annotated4" , containerFactory = "kafkaManualAckListenerContainerFactory" ,
1420- containerGroup = "qux#{'Group'}" , properties = {
1418+ @ KafkaListener (id = "#{'qux'}" , topics = "annotated4" ,
1419+ containerFactory = "kafkaManualAckListenerContainerFactory" , containerGroup = "qux#{'Group'}" ,
1420+ properties = {
14211421 "max.poll.interval.ms:#{'${poll.interval:60000}'}" ,
14221422 ConsumerConfig .MAX_POLL_RECORDS_CONFIG + "=#{'${poll.recs:100}'}"
14231423 })
@@ -1879,6 +1879,7 @@ public void setDelegate(
18791879 public Foo convert (String source ) {
18801880 return delegate .convert (source );
18811881 }
1882+
18821883 }
18831884
18841885 public static class ValidatedClass {
0 commit comments