@@ -351,12 +351,12 @@ protected CompletableFuture<SendResult<Integer, String>> doSend(
351351 @ SuppressWarnings ({"rawtypes" , "unchecked" })
352352 @ Test
353353 void immediateFailure () {
354- Producer producer = mock (Producer . class );
354+ Producer producer = mock ();
355355 CompletableFuture cf = new CompletableFuture ();
356356 RuntimeException rte = new RuntimeException ("test.immediate" );
357357 cf .completeExceptionally (rte );
358358 given (producer .send (any (), any ())).willReturn (cf );
359- ProducerFactory pf = mock (ProducerFactory . class );
359+ ProducerFactory pf = mock ();
360360 given (pf .createProducer ()).willReturn (producer );
361361 KafkaTemplate template = new KafkaTemplate (pf );
362362 template .setDefaultTopic ("foo" );
@@ -480,9 +480,9 @@ public void onPartitionsAssigned(Collection<TopicPartition> partitions) {
480480 @ SuppressWarnings ({"rawtypes" , "unchecked" })
481481 @ Test
482482 void testTransaction () {
483- ProducerFactory pf = mock (ProducerFactory . class );
483+ ProducerFactory pf = mock ();
484484 given (pf .transactionCapable ()).willReturn (true );
485- Producer producer = mock (Producer . class );
485+ Producer producer = mock ();
486486 given (pf .createProducer (isNull ())).willReturn (producer );
487487 willReturn (mock (Future .class )).given (producer ).send (any (ProducerRecord .class ), any (Callback .class ));
488488 KafkaTemplate template = new KafkaTemplate (pf );
@@ -502,7 +502,7 @@ void testTransaction() {
502502 @ SuppressWarnings ({"unchecked" , "rawtypes" })
503503 @ Test
504504 void testConsumeAndProduceTransaction () throws Exception {
505- Consumer mockConsumer = mock (Consumer . class );
505+ Consumer mockConsumer = mock ();
506506 final TopicPartition topicPartition = new TopicPartition ("foo" , 0 );
507507 willAnswer (i -> {
508508 ((ConsumerRebalanceListener ) i .getArgument (1 ))
@@ -521,9 +521,9 @@ void testConsumeAndProduceTransaction() throws Exception {
521521 return null ;
522522 }
523523 }).given (mockConsumer ).poll (any (Duration .class ));
524- ConsumerGroupMetadata meta = new ConsumerGroupMetadata ( "group" );
524+ ConsumerGroupMetadata meta = mock ( );
525525 given (mockConsumer .groupMetadata ()).willReturn (meta );
526- ConsumerFactory cf = mock (ConsumerFactory . class );
526+ ConsumerFactory cf = mock ();
527527 willReturn (mockConsumer ).given (cf ).createConsumer ("group" , "" , null , KafkaTestUtils .defaultPropertyOverrides ());
528528 Producer producer = mock (Producer .class );
529529 given (producer .send (any (), any ())).willReturn (mock (Future .class ));
@@ -532,7 +532,7 @@ void testConsumeAndProduceTransaction() throws Exception {
532532 closeLatch .countDown ();
533533 return null ;
534534 }).given (producer ).close (any ());
535- ProducerFactory pf = mock (ProducerFactory . class );
535+ ProducerFactory pf = mock ();
536536 given (pf .transactionCapable ()).willReturn (true );
537537 willReturn (producer ).given (pf ).createProducer (isNull ());
538538 KafkaTransactionManager ptm = new KafkaTransactionManager (pf );
@@ -577,7 +577,7 @@ void testConsumeAndProduceTransaction() throws Exception {
577577 @ SuppressWarnings ({"rawtypes" , "unchecked" })
578578 @ Test
579579 void testTransactionTxIdOverride () {
580- Producer producer = mock (Producer . class );
580+ Producer producer = mock ();
581581 AtomicReference <String > txId = new AtomicReference <>();
582582 DefaultKafkaProducerFactory pf = new DefaultKafkaProducerFactory (Collections .emptyMap ()) {
583583
@@ -609,8 +609,8 @@ protected Producer createTransactionalProducer(String txIdPrefix) {
609609 @ SuppressWarnings ({"rawtypes" , "unchecked" })
610610 @ Test
611611 void testTransactionSynch () {
612- Producer producer = mock (Producer . class );
613- ProducerFactory pf = mock (ProducerFactory . class );
612+ Producer producer = mock ();
613+ ProducerFactory pf = mock ();
614614 given (pf .transactionCapable ()).willReturn (true );
615615 given (pf .createProducer (isNull ())).willReturn (producer );
616616 willReturn (mock (Future .class )).given (producer ).send (any (ProducerRecord .class ), any (Callback .class ));
@@ -639,7 +639,7 @@ void testTransactionSynch() {
639639 @ SuppressWarnings ({"unchecked" , "rawtypes" })
640640 @ Test
641641 void testConsumeAndProduceTransactionTxIdOverride () throws Exception {
642- Consumer mockConsumer = mock (Consumer . class );
642+ Consumer mockConsumer = mock ();
643643 final TopicPartition topicPartition = new TopicPartition ("foo" , 0 );
644644 willAnswer (i -> {
645645 ((ConsumerRebalanceListener ) i .getArgument (1 ))
@@ -658,9 +658,9 @@ void testConsumeAndProduceTransactionTxIdOverride() throws Exception {
658658 return null ;
659659 }
660660 }).given (mockConsumer ).poll (any (Duration .class ));
661- ConsumerGroupMetadata meta = new ConsumerGroupMetadata ( "group" );
661+ ConsumerGroupMetadata meta = mock ( );
662662 given (mockConsumer .groupMetadata ()).willReturn (meta );
663- ConsumerFactory cf = mock (ConsumerFactory . class );
663+ ConsumerFactory cf = mock ();
664664 willReturn (mockConsumer ).given (cf ).createConsumer ("group" , "" , null , KafkaTestUtils .defaultPropertyOverrides ());
665665 Producer producer = mock (Producer .class );
666666 given (producer .send (any (), any ())).willReturn (mock (Future .class ));
@@ -740,8 +740,8 @@ void testTxNonTx() {
740740 @ SuppressWarnings ({"rawtypes" , "unchecked" })
741741 @ Test
742742 void testFlush () {
743- ProducerFactory pf = mock (ProducerFactory . class );
744- Producer producer = mock (Producer . class );
743+ ProducerFactory pf = mock ();
744+ Producer producer = mock ();
745745 given (pf .createProducer ()).willReturn (producer );
746746 willReturn (mock (Future .class )).given (producer ).send (any (ProducerRecord .class ), any (Callback .class ));
747747 KafkaTemplate template = new KafkaTemplate (pf );
@@ -763,8 +763,8 @@ void testFlush() {
763763 @ SuppressWarnings ({"rawtypes" , "unchecked" })
764764 @ Test
765765 void testNoFlush () {
766- ProducerFactory pf = mock (ProducerFactory . class );
767- Producer producer = mock (Producer . class );
766+ ProducerFactory pf = mock ();
767+ Producer producer = mock ();
768768 given (pf .createProducer ()).willReturn (producer );
769769 willReturn (mock (Future .class )).given (producer ).send (any (ProducerRecord .class ), any (Callback .class ));
770770 KafkaTemplate template = new KafkaTemplate (pf );
@@ -783,8 +783,8 @@ void testNoFlush() {
783783 @ SuppressWarnings ({"rawtypes" , "unchecked" })
784784 @ Test
785785 void conversion () {
786- ProducerFactory pf = mock (ProducerFactory . class );
787- Producer producer = mock (Producer . class );
786+ ProducerFactory pf = mock ();
787+ Producer producer = mock ();
788788 given (pf .createProducer ()).willReturn (producer );
789789 willReturn (mock (Future .class )).given (producer ).send (any (ProducerRecord .class ), any (Callback .class ));
790790 KafkaTemplate template = new KafkaTemplate (pf );
0 commit comments