From 92c0bbf36a1919d4d00bd8e5651f0023c5230718 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Fri, 18 Oct 2024 14:58:46 -0400 Subject: [PATCH] Optimize imports based on new checkstyle rules --- .../example/Sample05Application1Tests.java | 6 +-- .../example/Sample05Application2Tests.java | 6 +-- .../java/com/example/ApplicationTests.java | 4 +- .../kafka/kdocs/requestreply/Application.kt | 30 ++++++------- .../kdocs/started/consumer/Application.kt | 7 ++- .../kafka/kdocs/started/noboot/Sender.kt | 6 +-- .../kafka/test/EmbeddedKafkaBroker.java | 5 +-- .../kafka/test/EmbeddedKafkaKraftBroker.java | 7 ++- .../kafka/test/EmbeddedKafkaZKBroker.java | 15 +++---- .../kafka/test/core/BrokerAddress.java | 6 +-- .../test/EmbeddedKafkaKraftBrokerTests.java | 6 +-- .../test/EmbeddedKafkaZKBrokerTests.java | 6 +-- .../test/assertj/KafkaConditionsTests.java | 8 ++-- .../EmbeddedKafkaConditionTests.java | 6 +-- .../WithNestedClassContextTests.java | 4 +- .../condition/WithSpringTestContextTests.java | 6 +-- .../EmbeddedKafkaContextCustomizerTests.java | 4 +- .../test/hamcrest/KafkaMatchersTests.java | 16 +++---- ...beddedKafkaTestExecutionListenerTests.java | 6 +-- .../rule/AddressableEmbeddedBrokerTests.java | 6 +-- .../kafka/test/utils/KafkaTestUtilsTests.java | 6 +-- .../kafka/core/KafkaMetricsSupport.java | 11 +++-- .../kafka/core/KafkaTemplate.java | 5 +-- .../core/MicrometerConsumerListener.java | 8 ++-- .../core/MicrometerProducerListener.java | 7 ++- .../ReactiveKafkaConsumerTemplate.java | 5 +-- .../ReactiveKafkaProducerTemplate.java | 17 ++++--- .../KafkaMessageListenerContainer.java | 5 +-- .../kafka/listener/adapter/AdapterUtils.java | 3 +- ...inuationHandlerMethodArgumentResolver.java | 4 +- .../MessagingMessageListenerAdapter.java | 7 ++- .../KafkaStreamsMicrometerListener.java | 9 ++-- .../support/DefaultKafkaHeaderMapper.java | 7 ++- .../kafka/support/JacksonMimeTypeModule.java | 6 +-- .../kafka/support/JacksonUtils.java | 4 +- .../ByteArrayJsonMessageConverter.java | 8 ++-- .../converter/BytesJsonMessageConverter.java | 7 ++- .../converter/JsonMessageConverter.java | 9 ++-- .../MappingJacksonParameterizedConverter.java | 7 ++- .../converter/ProjectingMessageConverter.java | 7 ++- .../converter/StringJsonMessageConverter.java | 8 ++-- .../DefaultJackson2JavaTypeMapper.java | 7 ++- .../mapping/Jackson2JavaTypeMapper.java | 5 +-- .../micrometer/KafkaListenerObservation.java | 8 ++-- .../KafkaRecordReceiverContext.java | 3 +- .../micrometer/KafkaRecordSenderContext.java | 3 +- .../micrometer/KafkaTemplateObservation.java | 4 +- .../support/micrometer/MicrometerHolder.java | 12 ++--- .../support/serializer/JsonDeserializer.java | 11 +++-- .../kafka/support/serializer/JsonSerde.java | 9 ++-- .../support/serializer/JsonSerializer.java | 9 ++-- .../support/serializer/JsonTypeResolver.java | 5 +-- .../annotation/AliasPropertiesTests.java | 4 +- .../kafka/annotation/AsyncListenerTests.java | 7 ++- .../BatchListenerConversion2Tests.java | 6 +-- .../BatchListenerConversionTests.java | 12 ++--- .../annotation/ContainerFactoryTests.java | 8 ++-- .../EnableKafkaIntegrationTests.java | 37 ++++++++------- .../KafkaListenerEndpointRegistryTests.java | 12 ++--- .../config/KafkaStreamsCustomizerTests.java | 9 ++-- ...dMessagingMessageListenerAdapterTests.java | 6 +-- ...derFactoryBeanInMemoryStateStoreTests.java | 4 +- .../StreamsBuilderFactoryBeanTests.java | 8 ++-- .../StreamsBuilderFactoryLateConfigTests.java | 8 ++-- .../DefaultKafkaConsumerFactoryTests.java | 10 ++--- .../DefaultKafkaProducerFactoryTests.java | 28 ++++++------ ...faultTransactionIdSuffixStrategyTests.java | 8 ++-- .../kafka/core/KafkaAdminBadContextTests.java | 6 +-- .../kafka/core/KafkaAdminTests.java | 12 ++--- .../kafka/core/KafkaTemplateTests.java | 36 +++++++-------- .../core/KafkaTemplateTransactionTests.java | 36 +++++++-------- .../kafka/core/RoutingKafkaTemplateTests.java | 18 ++++---- .../core/TransactionSynchronizationTests.java | 14 +++--- ...KafkaProducerTemplateIntegrationTests.java | 27 ++++++----- ...erTemplateTransactionIntegrationTests.java | 29 ++++++------ .../kafka/listener/ABSwitchClusterTests.java | 12 ++--- .../AbstractConsumerSeekAwareTests.java | 6 +-- .../listener/AsyncAckAfterHandleTests.java | 6 +-- .../listener/CommitOnAssignmentTests.java | 22 ++++----- ...onContainerStoppingErrorHandler1Tests.java | 18 ++++---- ...onContainerStoppingErrorHandler2Tests.java | 16 +++---- ...onContainerStoppingErrorHandler3Tests.java | 18 ++++---- .../CommonDelegatingErrorHandlerTests.java | 18 ++++---- .../CommonMixedErrorHandlerTests.java | 6 +-- ...rentMessageListenerContainerMockTests.java | 24 +++++----- ...ncurrentMessageListenerContainerTests.java | 14 +++--- .../ConsumerAwareRebalanceListenerTests.java | 4 +- .../listener/ConsumerSeekAwareTests.java | 8 ++-- .../listener/ContainerCustomizationTests.java | 6 +-- .../ContainerEnforceRebalanceTests.java | 6 +-- .../ContainerGroupSequencerTests.java | 4 +- .../ContainerPauseImmediateTests.java | 18 ++++---- .../DeadLetterPublishingRecovererTests.java | 34 +++++++------- .../DefaultAfterRollbackProcessorTests.java | 22 ++++----- ...aultErrorHandlerBatchIntegrationTests.java | 4 +- .../DefaultErrorHandlerBatchTests.java | 26 +++++------ ...faultErrorHandlerNoSeeksBatchAckTests.java | 18 ++++---- ...ErrorHandlerNoSeeksBatchListenerTests.java | 20 ++++----- ...RecordAckNoResumeContainerPausedTests.java | 24 +++++----- ...oSeeksRecordAckNoResumePartitionTests.java | 24 +++++----- ...aultErrorHandlerNoSeeksRecordAckTests.java | 24 +++++----- .../DefaultErrorHandlerRecordTests.java | 26 +++++------ ...SeekAfterCommitExceptionBatchAckTests.java | 26 +++++------ ...fterCommitExceptionBatchListenerTests.java | 24 +++++----- ...rHandlerSeekAfterCommitExceptionTests.java | 26 +++++------ ...mptAwareRetryListenerIntegrationTests.java | 6 +-- ...eliveryAttemptAwareRetryListenerTests.java | 4 +- .../listener/ErrorHandlingCoverageTests.java | 6 +-- .../ErrorHandlingDeserializerTests.java | 4 +- .../listener/ErrorHandlingUtilsTest.java | 18 ++++---- .../listener/ExceptionClassifierTests.java | 6 +-- .../listener/FailedBatchProcessorTests.java | 22 ++++----- .../listener/FailedRecordProcessorTests.java | 6 +-- .../listener/FailedRecordTrackerTests.java | 10 ++--- ...backBatchErrorHandlerIntegrationTests.java | 4 +- .../FallbackBatchErrorHandlerTests.java | 31 +++++++------ .../HeaderMethodArgumentResolverTests.java | 6 +-- ...istenerEndpointRegistryLifecycleTests.java | 10 ++--- .../KafkaMessageListenerContainerTests.java | 34 +++++++------- .../ListenerContainerPauseServiceTests.java | 22 ++++----- .../listener/ListenerErrorHandlerTests.java | 12 ++--- .../kafka/listener/ListenerUtilsTests.java | 8 ++-- .../listener/LoggingErrorHandlerTests.java | 24 +++++----- .../listener/ManualAckPartialBatchTests.java | 18 ++++---- .../ManualAssignmentInitialSeekTests.java | 18 ++++---- .../kafka/listener/ManualNackBatchTests.java | 18 ++++---- .../listener/ManualNackBatchTxTests.java | 20 ++++----- .../listener/ManualNackPauseResumeTests.java | 14 +++--- .../kafka/listener/ManualNackRecordTests.java | 16 +++---- .../ManualNackRecordZeroSleepTests.java | 16 +++---- .../kafka/listener/MissingGroupIdTests.java | 6 +-- ...ingTopicCheckOverrideAdminConfigTests.java | 16 +++---- .../kafka/listener/MissingTopicsTests.java | 8 ++-- .../kafka/listener/MockConsumerTests.java | 6 +-- .../PauseContainerManualAssignmentTests.java | 24 +++++----- ...ainerWhileErrorHandlerIsRetryingTests.java | 12 ++--- .../RemainingRecordsErrorHandlerTests.java | 18 ++++---- .../SeekToCurrentOnErrorBatchModeTXTests.java | 20 ++++----- .../SeekToCurrentOnErrorBatchModeTests.java | 18 ++++---- ...SeekToCurrentOnErrorRecordModeTXTests.java | 22 ++++----- .../SeekToCurrentOnErrorRecordModeTests.java | 18 ++++---- .../listener/SeekToCurrentRecovererTests.java | 26 +++++------ .../listener/SubBatchPerPartitionTests.java | 22 ++++----- .../SubBatchPerPartitionTxRollbackTests.java | 20 ++++----- .../listener/SubBatchPerPartitionTxTests.java | 20 ++++----- .../kafka/listener/TestOOMError.java | 14 +++--- .../listener/TransactionalContainerTests.java | 40 ++++++++--------- .../BatchAdapterConversionErrorsTests.java | 10 ++--- .../BatchListenerWithRecordAdapterTests.java | 6 +-- ...hMessagingMessageListenerAdapterTests.java | 17 ++++--- .../ConvertingMessageListenerTests.java | 19 ++++---- .../adapter/FilteringAdapterTests.java | 16 +++---- ...ckoffAwareMessageListenerAdapterTests.java | 24 +++++----- .../MessagingMessageListenerAdapterTests.java | 19 ++++---- .../requestreply/CorrelationKeyTests.java | 6 +-- .../ReplyingKafkaTemplateTests.java | 18 ++++---- ...eRetryTopicClassLevelIntegrationTests.java | 8 ++-- ...pletableFutureRetryTopicScenarioTests.java | 6 +-- ...eRetryTopicClassLevelIntegrationTests.java | 9 ++-- .../AsyncMonoRetryTopicScenarioTests.java | 7 ++- .../BackOffValuesGeneratorTests.java | 6 +-- .../retrytopic/CircularDltHandlerTests.java | 6 +-- ...LetterPublishingRecovererFactoryTests.java | 30 ++++++------- ...DefaultDestinationTopicProcessorTests.java | 12 ++--- .../DefaultDestinationTopicResolverTests.java | 10 ++--- .../kafka/retrytopic/DeliveryHeaderTests.java | 4 +- ...estinationTopicPropertiesFactoryTests.java | 4 +- .../kafka/retrytopic/DltStartupTests.java | 6 +-- .../EndpointCustomizerFactoryTests.java | 8 ++-- ...gRetryTopicClassLevelIntegrationTests.java | 6 +-- .../ExistingRetryTopicIntegrationTests.java | 6 +-- ...stenerContainerFactoryConfigurerTests.java | 22 ++++----- ...ListenerContainerFactoryResolverTests.java | 12 ++--- .../retrytopic/PartitionResolverTests.java | 14 +++--- ...LevelExceptionRoutingIntegrationTests.java | 6 +-- .../RetryTopicClassLevelIntegrationTests.java | 8 ++-- .../RetryTopicConfigurationBuilderTests.java | 6 +-- ...tryTopicConfigurationIntegrationTests.java | 10 ++--- ...ationManualAssignmentIntegrationTests.java | 8 ++-- .../RetryTopicConfigurationProviderTests.java | 18 ++++---- .../RetryTopicConfigurationSupportTests.java | 22 ++++----- .../retrytopic/RetryTopicConfigurerTests.java | 18 ++++---- .../retrytopic/RetryTopicConstantsTests.java | 6 +-- ...TopicExceptionRoutingIntegrationTests.java | 6 +-- .../retrytopic/RetryTopicHeadersTests.java | 6 +-- .../RetryTopicIntegrationTests.java | 8 ++-- ...cSameContainerFactoryIntegrationTests.java | 10 ++--- ...etryableTopicAnnotationProcessorTests.java | 16 +++---- .../KafkaJaasLoginModuleInitializerTests.java | 7 ++- .../kafka/streams/Configurer1Tests.java | 4 +- .../kafka/streams/Configurer2Tests.java | 4 +- .../streams/HeaderEnricherProcessorTests.java | 6 +-- .../streams/KafkaStreamsBranchTests.java | 4 +- ...kaStreamsInteractiveQueryServiceTests.java | 14 +++--- .../KafkaStreamsJsonSerializationTests.java | 7 ++- .../kafka/streams/KafkaStreamsTests.java | 7 ++- ...gDeserializationExceptionHandlerTests.java | 4 +- .../messaging/MessagingProcessorTests.java | 6 +-- .../DefaultKafkaHeaderMapperTests.java | 6 +-- ...ExponentialBackOffWithMaxRetriesTests.java | 8 ++-- .../support/KafkaStreamBrancherTests.java | 14 +++--- .../kafka/support/LogIfLevelEnabledTests.java | 14 +++--- .../support/LoggingProducerListenerTests.java | 12 ++--- .../support/SimpleKafkaHeaderMapperTests.java | 10 ++--- .../support/TopicPartitionOffsetTests.java | 6 +-- .../converter/BatchMessageConverterTests.java | 8 ++-- .../MessagingMessageConverterTests.java | 6 +-- .../ProjectingMessageConverterTests.java | 13 +++--- .../micrometer/MicrometerHolderTests.java | 25 +++++------ .../ObservationIntegrationTests.java | 19 ++++---- .../support/micrometer/ObservationTests.java | 45 +++++++++---------- .../DelegatingByTopicSerializationTests.java | 4 +- .../DelegatingSerializationTests.java | 12 ++--- .../support/serializer/JsonSerdeTests.java | 6 +-- .../serializer/JsonSerializationTests.java | 27 ++++++----- .../serializer/RetryingDeserializerTests.java | 10 ++--- .../SerializationIntegrationTests.java | 6 +-- .../serializer/SerializationUtilsTests.java | 16 +++---- .../StringOrBytesSerializerTests.java | 4 +- .../ToStringSerializationTests.java | 4 +- .../EnableKafkaKotlinCoroutinesTests.kt | 7 +-- .../kafka/listener/EnableKafkaKotlinTests.kt | 7 +-- src/checkstyle/checkstyle.xml | 5 +-- 223 files changed, 1325 insertions(+), 1389 deletions(-) diff --git a/samples/sample-05/src/test/java/com/example/Sample05Application1Tests.java b/samples/sample-05/src/test/java/com/example/Sample05Application1Tests.java index 8c61d12f43..537aa7997c 100644 --- a/samples/sample-05/src/test/java/com/example/Sample05Application1Tests.java +++ b/samples/sample-05/src/test/java/com/example/Sample05Application1Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package com.example; -import static org.awaitility.Awaitility.await; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -28,6 +26,8 @@ import org.springframework.kafka.core.KafkaTemplate; import org.springframework.test.annotation.DirtiesContext; +import static org.awaitility.Awaitility.await; + /** * This test is going to fail from IDE since there is no exposed {@code spring.kafka.bootstrap-servers} system property. * Use Maven to run tests which enables global embedded Kafka broker via properties provided to Surefire plugin. diff --git a/samples/sample-05/src/test/java/com/example/Sample05Application2Tests.java b/samples/sample-05/src/test/java/com/example/Sample05Application2Tests.java index 6a567a66eb..8943ca9075 100644 --- a/samples/sample-05/src/test/java/com/example/Sample05Application2Tests.java +++ b/samples/sample-05/src/test/java/com/example/Sample05Application2Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package com.example; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import java.util.concurrent.TimeUnit; import org.apache.kafka.common.errors.TimeoutException; @@ -29,6 +27,8 @@ import org.springframework.kafka.core.KafkaTemplate; import org.springframework.test.annotation.DirtiesContext; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + /** * This test is going to fail from IDE since there is no exposed {@code spring.kafka.bootstrap-servers} system property. * This test demonstrates that global embedded Kafka broker config for {@code auto.create.topics.enable=false} diff --git a/samples/sample-06/src/test/java/com/example/ApplicationTests.java b/samples/sample-06/src/test/java/com/example/ApplicationTests.java index 76cd9b521e..8493312d2d 100644 --- a/samples/sample-06/src/test/java/com/example/ApplicationTests.java +++ b/samples/sample-06/src/test/java/com/example/ApplicationTests.java @@ -19,8 +19,6 @@ import java.time.Duration; import java.util.List; -import static org.assertj.core.api.Assertions.assertThat; - import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.streams.TestInputTopic; import org.apache.kafka.streams.TestOutputTopic; @@ -37,6 +35,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.kafka.config.StreamsBuilderFactoryBean; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Nacho Munoz * @author Soby Chacko diff --git a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/requestreply/Application.kt b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/requestreply/Application.kt index b7781dd58b..902ed27d04 100644 --- a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/requestreply/Application.kt +++ b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/requestreply/Application.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,27 +15,25 @@ */ package org.springframework.kafka.kdocs.requestreply -import org.springframework.boot.autoconfigure.SpringBootApplication -import org.springframework.kafka.core.KafkaAdmin.NewTopics -import org.springframework.kafka.config.TopicBuilder -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory -import org.springframework.kafka.requestreply.ReplyingKafkaTemplate -import org.springframework.kafka.support.converter.ByteArrayJsonMessageConverter -import org.springframework.boot.ApplicationRunner -import org.springframework.boot.ApplicationArguments -import org.springframework.kafka.requestreply.RequestReplyTypedMessageFuture -import org.springframework.messaging.support.MessageBuilder -import org.springframework.core.ParameterizedTypeReference -import org.springframework.kafka.annotation.KafkaListener -import org.springframework.messaging.handler.annotation.SendTo -import kotlin.jvm.JvmStatic import org.apache.kafka.common.serialization.ByteArrayDeserializer import org.apache.kafka.common.serialization.ByteArraySerializer import org.slf4j.LoggerFactory +import org.springframework.boot.ApplicationRunner import org.springframework.boot.SpringApplication +import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.context.annotation.Bean +import org.springframework.core.ParameterizedTypeReference +import org.springframework.kafka.annotation.KafkaListener +import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory +import org.springframework.kafka.config.TopicBuilder +import org.springframework.kafka.core.KafkaAdmin.NewTopics +import org.springframework.kafka.core.KafkaTemplate import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.requestreply.ReplyingKafkaTemplate +import org.springframework.kafka.requestreply.RequestReplyTypedMessageFuture +import org.springframework.kafka.support.converter.ByteArrayJsonMessageConverter +import org.springframework.messaging.handler.annotation.SendTo +import org.springframework.messaging.support.MessageBuilder import java.util.concurrent.TimeUnit import java.util.function.Consumer diff --git a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/consumer/Application.kt b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/consumer/Application.kt index a7fecb0aee..f547d9dbdc 100644 --- a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/consumer/Application.kt +++ b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/consumer/Application.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,11 @@ */ package org.springframework.kafka.kdocs.started.consumer -import org.springframework.boot.autoconfigure.SpringBootApplication import org.apache.kafka.clients.admin.NewTopic -import org.springframework.kafka.annotation.KafkaListener -import kotlin.jvm.JvmStatic +import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.runApplication import org.springframework.context.annotation.Bean +import org.springframework.kafka.annotation.KafkaListener import org.springframework.kafka.kdocs.started.producer.Application /** diff --git a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/noboot/Sender.kt b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/noboot/Sender.kt index aca85c641e..848ad36e8a 100644 --- a/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/noboot/Sender.kt +++ b/spring-kafka-docs/src/main/kotlin/org/springframework/kafka/kdocs/started/noboot/Sender.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,11 +15,7 @@ */ package org.springframework.kafka.kdocs.started.noboot -import org.springframework.boot.runApplication import org.springframework.kafka.core.KafkaTemplate -import kotlin.jvm.JvmStatic -import org.springframework.context.annotation.AnnotationConfigApplicationContext -import org.springframework.kafka.kdocs.started.producer.Application /** * Code snippet for quick start. diff --git a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java index 9c5b74d868..588735a91d 100644 --- a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java +++ b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaBroker.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,13 @@ import java.util.Map; import java.util.Set; +import kafka.server.KafkaConfig; import org.apache.kafka.clients.admin.NewTopic; import org.apache.kafka.clients.consumer.Consumer; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; -import kafka.server.KafkaConfig; - /** * @author Gary Russell * @since 3.1 diff --git a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaKraftBroker.java b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaKraftBroker.java index cc80a5b106..41bd32b196 100644 --- a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaKraftBroker.java +++ b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaKraftBroker.java @@ -38,6 +38,9 @@ import java.util.function.Function; import java.util.stream.Collectors; +import kafka.server.KafkaConfig; +import kafka.testkit.KafkaClusterTestKit; +import kafka.testkit.TestKitNodes; import org.apache.commons.logging.LogFactory; import org.apache.kafka.clients.CommonClientConfigs; import org.apache.kafka.clients.admin.AdminClient; @@ -54,10 +57,6 @@ import org.springframework.core.log.LogAccessor; import org.springframework.util.Assert; -import kafka.server.KafkaConfig; -import kafka.testkit.KafkaClusterTestKit; -import kafka.testkit.TestKitNodes; - /** * An embedded Kafka Broker(s) using KRaft. * This class is intended to be used in the unit tests. diff --git a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaZKBroker.java b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaZKBroker.java index f50c9f214f..00c0551348 100644 --- a/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaZKBroker.java +++ b/spring-kafka-test/src/main/java/org/springframework/kafka/test/EmbeddedKafkaZKBroker.java @@ -42,6 +42,13 @@ import java.util.function.Function; import java.util.stream.Collectors; +import kafka.cluster.EndPoint; +import kafka.server.KafkaConfig; +import kafka.server.KafkaServer; +import kafka.utils.CoreUtils; +import kafka.utils.TestUtils; +import kafka.zk.ZkFourLetterWords; +import kafka.zookeeper.ZooKeeperClient; import org.apache.commons.logging.LogFactory; import org.apache.kafka.clients.admin.AdminClient; import org.apache.kafka.clients.admin.AdminClientConfig; @@ -67,14 +74,6 @@ import org.springframework.retry.support.RetryTemplate; import org.springframework.util.Assert; -import kafka.cluster.EndPoint; -import kafka.server.KafkaConfig; -import kafka.server.KafkaServer; -import kafka.utils.CoreUtils; -import kafka.utils.TestUtils; -import kafka.zk.ZkFourLetterWords; -import kafka.zookeeper.ZooKeeperClient; - /** * An embedded Kafka Broker(s) and Zookeeper manager. * This class is intended to be used in the unit tests. diff --git a/spring-kafka-test/src/main/java/org/springframework/kafka/test/core/BrokerAddress.java b/spring-kafka-test/src/main/java/org/springframework/kafka/test/core/BrokerAddress.java index 1e25258c02..3560552d9a 100644 --- a/spring-kafka-test/src/main/java/org/springframework/kafka/test/core/BrokerAddress.java +++ b/spring-kafka-test/src/main/java/org/springframework/kafka/test/core/BrokerAddress.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2019 the original author or authors. + * Copyright 2015-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.test.core; -import org.springframework.util.Assert; - import kafka.cluster.BrokerEndPoint; +import org.springframework.util.Assert; + /** * Encapsulates the address of a Kafka broker. * diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java index 86766caa2e..50fe009357 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ package org.springframework.kafka.test; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.util.StringUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 3.1 diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaZKBrokerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaZKBrokerTests.java index eaf16d9a1c..4688e38e2d 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaZKBrokerTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaZKBrokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.test; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/assertj/KafkaConditionsTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/assertj/KafkaConditionsTests.java index dc521f22f7..e4aca5f806 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/assertj/KafkaConditionsTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/assertj/KafkaConditionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.springframework.kafka.test.assertj; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.junit.jupiter.api.Test; + import static org.assertj.core.api.Assertions.allOf; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.kafka.test.assertj.KafkaConditions.keyValue; import static org.springframework.kafka.test.assertj.KafkaConditions.partition; -import org.apache.kafka.clients.consumer.ConsumerRecord; -import org.junit.jupiter.api.Test; - /** * @author Gary Russell * @since 2.2.12 diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/EmbeddedKafkaConditionTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/EmbeddedKafkaConditionTests.java index 012d4222ba..4a0f0dcde9 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/EmbeddedKafkaConditionTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/EmbeddedKafkaConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.test.condition; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.kafka.test.EmbeddedKafkaBroker; @@ -25,6 +23,8 @@ import org.springframework.kafka.test.context.EmbeddedKafka; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author MichaƂ Padula diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithNestedClassContextTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithNestedClassContextTests.java index 4a98120112..f95eb99264 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithNestedClassContextTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithNestedClassContextTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.test.condition; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -31,6 +29,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Lee Jaeheon * @author Soby Chacko diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithSpringTestContextTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithSpringTestContextTests.java index 337af55f0b..9e19000b9c 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithSpringTestContextTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/condition/WithSpringTestContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.test.condition; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -27,6 +25,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.7.2 diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/context/EmbeddedKafkaContextCustomizerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/context/EmbeddedKafkaContextCustomizerTests.java index b3bc00c373..6147490df6 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/context/EmbeddedKafkaContextCustomizerTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/context/EmbeddedKafkaContextCustomizerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.test.context; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -27,6 +25,8 @@ import org.springframework.kafka.test.EmbeddedKafkaBroker; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Oleg Artyomov * @author Sergio Lourenco diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/hamcrest/KafkaMatchersTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/hamcrest/KafkaMatchersTests.java index 37c07fd32a..d7a3a129b2 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/hamcrest/KafkaMatchersTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/hamcrest/KafkaMatchersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,6 @@ package org.springframework.kafka.test.hamcrest; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasKey; -import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasPartition; -import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasTimestamp; -import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasValue; - import java.util.Optional; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -30,6 +23,13 @@ import org.apache.kafka.common.record.TimestampType; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasKey; +import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasPartition; +import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasTimestamp; +import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasValue; + /** * @author Biju Kunjummen * diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/junit/GlobalEmbeddedKafkaTestExecutionListenerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/junit/GlobalEmbeddedKafkaTestExecutionListenerTests.java index 4137dcbd1f..664ba13aaf 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/junit/GlobalEmbeddedKafkaTestExecutionListenerTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/junit/GlobalEmbeddedKafkaTestExecutionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.test.junit; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -49,6 +47,8 @@ import org.springframework.util.DefaultPropertiesPersister; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Artem Bilan * diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/rule/AddressableEmbeddedBrokerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/rule/AddressableEmbeddedBrokerTests.java index bb75e0715d..3842a27ab7 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/rule/AddressableEmbeddedBrokerTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/rule/AddressableEmbeddedBrokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.test.rule; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.IOException; import java.net.ServerSocket; import java.util.Map; @@ -39,6 +37,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Kamill Sokol diff --git a/spring-kafka-test/src/test/java/org/springframework/kafka/test/utils/KafkaTestUtilsTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/utils/KafkaTestUtilsTests.java index b8f12fde84..e5be343800 100644 --- a/spring-kafka-test/src/test/java/org/springframework/kafka/test/utils/KafkaTestUtilsTests.java +++ b/spring-kafka-test/src/test/java/org/springframework/kafka/test/utils/KafkaTestUtilsTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.test.utils; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import java.time.Duration; import java.util.List; import java.util.Map; @@ -38,6 +35,9 @@ import org.springframework.kafka.test.EmbeddedKafkaBroker; import org.springframework.kafka.test.context.EmbeddedKafka; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaMetricsSupport.java b/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaMetricsSupport.java index dc3de51fd1..ea01cee167 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaMetricsSupport.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaMetricsSupport.java @@ -28,6 +28,11 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import io.micrometer.core.instrument.ImmutableTag; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics; import org.apache.kafka.clients.admin.AdminClient; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.producer.Producer; @@ -38,12 +43,6 @@ import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; -import io.micrometer.core.instrument.ImmutableTag; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Tag; -import io.micrometer.core.instrument.binder.MeterBinder; -import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics; - /** * An abstract class to manage {@link KafkaClientMetrics}. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java b/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java index 0f07679659..9e4c267503 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/KafkaTemplate.java @@ -33,6 +33,8 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.function.Function; +import io.micrometer.observation.Observation; +import io.micrometer.observation.ObservationRegistry; import org.apache.commons.logging.LogFactory; import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.consumer.Consumer; @@ -82,9 +84,6 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import io.micrometer.observation.Observation; -import io.micrometer.observation.ObservationRegistry; - /** * A template for executing high-level operations. When used with a * {@link DefaultKafkaProducerFactory}, the template is thread-safe. The producer factory diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerConsumerListener.java b/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerConsumerListener.java index bdf3e29cd2..7a70eaa0c2 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerConsumerListener.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerConsumerListener.java @@ -19,14 +19,12 @@ import java.util.Collections; import java.util.List; - -import org.apache.kafka.clients.consumer.Consumer; - -import org.springframework.scheduling.TaskScheduler; - import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics; +import org.apache.kafka.clients.consumer.Consumer; + +import org.springframework.scheduling.TaskScheduler; /** * A consumer factory listener that manages {@link KafkaClientMetrics}. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerProducerListener.java b/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerProducerListener.java index 343378a110..85c54ffd30 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerProducerListener.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/MicrometerProducerListener.java @@ -19,13 +19,12 @@ import java.util.Collections; import java.util.List; -import org.apache.kafka.clients.producer.Producer; - -import org.springframework.scheduling.TaskScheduler; - import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics; +import org.apache.kafka.clients.producer.Producer; + +import org.springframework.scheduling.TaskScheduler; /** * A producer factory listener that manages {@link KafkaClientMetrics}. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaConsumerTemplate.java b/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaConsumerTemplate.java index 09e28dbbcb..cd5aaf3fdd 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaConsumerTemplate.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaConsumerTemplate.java @@ -30,9 +30,6 @@ import org.apache.kafka.common.MetricName; import org.apache.kafka.common.PartitionInfo; import org.apache.kafka.common.TopicPartition; - -import org.springframework.util.Assert; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.kafka.receiver.KafkaReceiver; @@ -42,6 +39,8 @@ import reactor.util.function.Tuple2; import reactor.util.function.Tuples; +import org.springframework.util.Assert; + /** * Reactive kafka consumer operations implementation. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplate.java b/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplate.java index e2e9af4771..78d0473223 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplate.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,14 +26,6 @@ import org.apache.kafka.common.MetricName; import org.apache.kafka.common.PartitionInfo; import org.reactivestreams.Publisher; - -import org.springframework.beans.factory.DisposableBean; -import org.springframework.kafka.support.KafkaHeaders; -import org.springframework.kafka.support.converter.MessagingMessageConverter; -import org.springframework.kafka.support.converter.RecordMessageConverter; -import org.springframework.messaging.Message; -import org.springframework.util.Assert; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.kafka.sender.KafkaSender; @@ -44,6 +36,13 @@ import reactor.util.function.Tuple2; import reactor.util.function.Tuples; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.kafka.support.KafkaHeaders; +import org.springframework.kafka.support.converter.MessagingMessageConverter; +import org.springframework.kafka.support.converter.RecordMessageConverter; +import org.springframework.messaging.Message; +import org.springframework.util.Assert; + /** * Reactive kafka producer operations implementation. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java b/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java index fcc4ddd444..51eb755577 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java @@ -49,6 +49,8 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; +import io.micrometer.observation.Observation; +import io.micrometer.observation.ObservationRegistry; import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.consumer.CommitFailedException; import org.apache.kafka.clients.consumer.Consumer; @@ -138,9 +140,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; -import io.micrometer.observation.Observation; -import io.micrometer.observation.ObservationRegistry; - /** * Single-threaded Message listener container using the Java {@link Consumer} supporting * auto-partition assignment or user-configured assignment. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/AdapterUtils.java b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/AdapterUtils.java index de9e0d7d2c..1f93eb8138 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/AdapterUtils.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/AdapterUtils.java @@ -21,6 +21,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.producer.RecordMetadata; import org.apache.kafka.common.TopicPartition; +import reactor.core.publisher.Mono; import org.springframework.expression.ParserContext; import org.springframework.expression.common.TemplateParserContext; @@ -28,8 +29,6 @@ import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; -import reactor.core.publisher.Mono; - /** * Utilities for listener adapters. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/ContinuationHandlerMethodArgumentResolver.java b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/ContinuationHandlerMethodArgumentResolver.java index 23da8298d6..d17fc19080 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/ContinuationHandlerMethodArgumentResolver.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/ContinuationHandlerMethodArgumentResolver.java @@ -16,12 +16,12 @@ package org.springframework.kafka.listener.adapter; +import reactor.core.publisher.Mono; + import org.springframework.core.MethodParameter; import org.springframework.messaging.Message; import org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolver; -import reactor.core.publisher.Mono; - /** * No-op resolver for method arguments of type {@link kotlin.coroutines.Continuation}. *

diff --git a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java index 4c4f4cb078..5059141c69 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapter.java @@ -32,11 +32,14 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; +import io.micrometer.observation.Observation; +import io.micrometer.observation.ObservationRegistry; import org.apache.commons.logging.LogFactory; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.common.TopicPartition; +import reactor.core.publisher.Mono; import org.springframework.context.expression.MapAccessor; import org.springframework.core.MethodParameter; @@ -75,10 +78,6 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; -import io.micrometer.observation.Observation; -import io.micrometer.observation.ObservationRegistry; -import reactor.core.publisher.Mono; - /** * An abstract {@link org.springframework.kafka.listener.MessageListener} adapter * providing the necessary infrastructure to extract the payload of a diff --git a/spring-kafka/src/main/java/org/springframework/kafka/streams/KafkaStreamsMicrometerListener.java b/spring-kafka/src/main/java/org/springframework/kafka/streams/KafkaStreamsMicrometerListener.java index d25dd60dc8..f0afd5045f 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/streams/KafkaStreamsMicrometerListener.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/streams/KafkaStreamsMicrometerListener.java @@ -19,17 +19,16 @@ import java.util.Collections; import java.util.List; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.kafka.KafkaStreamsMetrics; import org.apache.kafka.streams.KafkaStreams; import org.springframework.kafka.config.StreamsBuilderFactoryBean; import org.springframework.kafka.core.KafkaMetricsSupport; import org.springframework.scheduling.TaskScheduler; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Tag; -import io.micrometer.core.instrument.binder.MeterBinder; -import io.micrometer.core.instrument.binder.kafka.KafkaStreamsMetrics; - /** * Creates a {@link KafkaStreamsMetrics} for the {@link KafkaStreams}. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/DefaultKafkaHeaderMapper.java b/spring-kafka/src/main/java/org/springframework/kafka/support/DefaultKafkaHeaderMapper.java index 25bf914bd3..0be018fd8d 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/DefaultKafkaHeaderMapper.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/DefaultKafkaHeaderMapper.java @@ -27,6 +27,9 @@ import java.util.Map; import java.util.Set; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.common.header.Header; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.header.internals.RecordHeader; @@ -35,10 +38,6 @@ import org.springframework.util.Assert; import org.springframework.util.ClassUtils; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - /** * Default header mapper for Apache Kafka. * Most headers in {@link KafkaHeaders} are not mapped on outbound messages. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonMimeTypeModule.java b/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonMimeTypeModule.java index c353c20fdb..f876abea65 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonMimeTypeModule.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonMimeTypeModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,13 @@ import java.io.IOException; -import org.springframework.util.MimeType; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.module.SimpleModule; +import org.springframework.util.MimeType; + /** * A {@link SimpleModule} extension for {@link MimeType} serialization. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonUtils.java b/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonUtils.java index f525166905..042640c35d 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonUtils.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/JacksonUtils.java @@ -16,13 +16,13 @@ package org.springframework.kafka.support; -import org.springframework.util.ClassUtils; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; +import org.springframework.util.ClassUtils; + /** * The utilities for Jackson {@link ObjectMapper} instances. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ByteArrayJsonMessageConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ByteArrayJsonMessageConverter.java index b359ae3f95..e5256cdf51 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ByteArrayJsonMessageConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ByteArrayJsonMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ package org.springframework.kafka.support.converter; -import org.springframework.kafka.support.KafkaNull; -import org.springframework.messaging.Message; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.kafka.support.KafkaNull; +import org.springframework.messaging.Message; + /** * JSON Message converter - {@code byte[]} on output, String, Bytes, or byte[] on input. * Used in conjunction with Kafka diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/BytesJsonMessageConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/BytesJsonMessageConverter.java index 65e3ca86df..58b4ea11ce 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/BytesJsonMessageConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/BytesJsonMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,13 @@ package org.springframework.kafka.support.converter; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.common.utils.Bytes; import org.springframework.kafka.support.KafkaNull; import org.springframework.messaging.Message; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - /** * JSON Message converter - {@code Bytes} on output, String, Bytes, or byte[] on input. * Used in conjunction with Kafka diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/JsonMessageConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/JsonMessageConverter.java index a32872c18c..201f3b0779 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/JsonMessageConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/JsonMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,9 @@ import java.io.IOException; import java.lang.reflect.Type; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.header.internals.RecordHeaders; @@ -32,10 +35,6 @@ import org.springframework.messaging.Message; import org.springframework.util.Assert; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; - /** * Base class for JSON message converters; on the consumer side, it can * handle {@code byte[]}, {@link Bytes} and {@link String} record values. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/MappingJacksonParameterizedConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/MappingJacksonParameterizedConverter.java index cb534678ee..7744d5ee9b 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/MappingJacksonParameterizedConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/MappingJacksonParameterizedConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ import java.io.IOException; import java.lang.reflect.Type; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.utils.Bytes; @@ -32,9 +34,6 @@ import org.springframework.util.Assert; import org.springframework.util.MimeType; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.type.TypeFactory; - /** * Subclass of {@link MappingJackson2MessageConverter} that can handle parameterized * (generic) types. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ProjectingMessageConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ProjectingMessageConverter.java index 6a78d3bc03..1a774c3cb9 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ProjectingMessageConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/ProjectingMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,8 @@ import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.utils.Bytes; @@ -34,9 +36,6 @@ import org.springframework.messaging.Message; import org.springframework.util.Assert; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; - /** * A {@link MessageConverter} implementation that uses a Spring Data * {@link ProjectionFactory} to bind incoming messages to projection interfaces. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/StringJsonMessageConverter.java b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/StringJsonMessageConverter.java index 869b8d2762..24814cd239 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/converter/StringJsonMessageConverter.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/converter/StringJsonMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 the original author or authors. + * Copyright 2016-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ package org.springframework.kafka.support.converter; -import org.springframework.kafka.support.KafkaNull; -import org.springframework.messaging.Message; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.kafka.support.KafkaNull; +import org.springframework.messaging.Message; + /** * JSON Message converter - String on output, String, Bytes, or byte[] on input. Used in * conjunction with Kafka diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/DefaultJackson2JavaTypeMapper.java b/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/DefaultJackson2JavaTypeMapper.java index 42e3519f15..5a9b64df27 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/DefaultJackson2JavaTypeMapper.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/DefaultJackson2JavaTypeMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ import java.util.List; import java.util.Set; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; import org.apache.kafka.common.header.Headers; import org.springframework.messaging.converter.MessageConversionException; @@ -27,9 +29,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.PatternMatchUtils; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.type.TypeFactory; - /** * Jackson 2 type mapper. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/Jackson2JavaTypeMapper.java b/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/Jackson2JavaTypeMapper.java index 3f45504a88..91cd1960da 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/Jackson2JavaTypeMapper.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/mapping/Jackson2JavaTypeMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,8 @@ package org.springframework.kafka.support.mapping; -import org.apache.kafka.common.header.Headers; - import com.fasterxml.jackson.databind.JavaType; +import org.apache.kafka.common.header.Headers; /** * Strategy for setting metadata on messages such that one can create the class that needs diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaListenerObservation.java b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaListenerObservation.java index 41bd285fe9..aaec5c5275 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaListenerObservation.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaListenerObservation.java @@ -16,16 +16,16 @@ package org.springframework.kafka.support.micrometer; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.util.StringUtils; - import io.micrometer.common.KeyValues; import io.micrometer.common.docs.KeyName; import io.micrometer.observation.Observation.Context; import io.micrometer.observation.ObservationConvention; import io.micrometer.observation.docs.ObservationDocumentation; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; +import org.springframework.util.StringUtils; + /** * Spring for Apache Kafka Observation for listeners. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordReceiverContext.java b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordReceiverContext.java index 847fd6ba7e..f93dce1842 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordReceiverContext.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordReceiverContext.java @@ -19,13 +19,12 @@ import java.nio.charset.StandardCharsets; import java.util.function.Supplier; +import io.micrometer.observation.transport.ReceiverContext; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.header.Header; import org.springframework.lang.Nullable; -import io.micrometer.observation.transport.ReceiverContext; - /** * {@link ReceiverContext} for {@link ConsumerRecord}s. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordSenderContext.java b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordSenderContext.java index 615e2db727..0d18699313 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordSenderContext.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaRecordSenderContext.java @@ -19,9 +19,8 @@ import java.nio.charset.StandardCharsets; import java.util.function.Supplier; -import org.apache.kafka.clients.producer.ProducerRecord; - import io.micrometer.observation.transport.SenderContext; +import org.apache.kafka.clients.producer.ProducerRecord; /** * {@link SenderContext} for {@link ProducerRecord}s. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaTemplateObservation.java b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaTemplateObservation.java index e926f98661..f50710e5d6 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaTemplateObservation.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/KafkaTemplateObservation.java @@ -16,14 +16,14 @@ package org.springframework.kafka.support.micrometer; -import org.springframework.lang.NonNull; - import io.micrometer.common.KeyValues; import io.micrometer.common.docs.KeyName; import io.micrometer.observation.Observation.Context; import io.micrometer.observation.ObservationConvention; import io.micrometer.observation.docs.ObservationDocumentation; +import org.springframework.lang.NonNull; + /** * Spring for Apache Kafka Observation for * {@link org.springframework.kafka.core.KafkaTemplate}. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/MicrometerHolder.java b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/MicrometerHolder.java index 782745925b..42af8dba61 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/MicrometerHolder.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/micrometer/MicrometerHolder.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,16 +20,16 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; -import org.springframework.beans.factory.NoUniqueBeanDefinitionException; -import org.springframework.context.ApplicationContext; -import org.springframework.lang.Nullable; -import org.springframework.util.Assert; - import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Timer; import io.micrometer.core.instrument.Timer.Builder; import io.micrometer.core.instrument.Timer.Sample; +import org.springframework.beans.factory.NoUniqueBeanDefinitionException; +import org.springframework.context.ApplicationContext; +import org.springframework.lang.Nullable; +import org.springframework.util.Assert; + /** * A wrapper for micrometer timers when available on the class path. * diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java index e72e08bf49..243c658459 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonDeserializer.java @@ -27,6 +27,11 @@ import java.util.Set; import java.util.function.BiFunction; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; +import com.fasterxml.jackson.databind.type.TypeFactory; import org.apache.kafka.common.errors.SerializationException; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.serialization.Deserializer; @@ -42,12 +47,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectReader; -import com.fasterxml.jackson.databind.type.TypeFactory; - /** * Generic {@link org.apache.kafka.common.serialization.Deserializer Deserializer} for * receiving JSON from Kafka and return Java objects. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerde.java b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerde.java index 8cdfbb114e..168b9f866a 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerde.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerde.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,9 @@ import java.util.Map; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.common.serialization.Serde; import org.springframework.core.ResolvableType; @@ -26,10 +29,6 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; - /** * A {@link org.apache.kafka.common.serialization.Serde} that provides serialization and * deserialization in JSON format. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerializer.java b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerializer.java index aaa8f8de3c..83e49be1f3 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerializer.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonSerializer.java @@ -20,6 +20,10 @@ import java.util.HashMap; import java.util.Map; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; import org.apache.kafka.common.errors.SerializationException; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.serialization.Serializer; @@ -33,11 +37,6 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; - /** * Generic {@link org.apache.kafka.common.serialization.Serializer Serializer} for sending * Java objects to Kafka as JSON. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonTypeResolver.java b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonTypeResolver.java index fa3d486017..dad78f8f43 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonTypeResolver.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/support/serializer/JsonTypeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,8 @@ package org.springframework.kafka.support.serializer; -import org.apache.kafka.common.header.Headers; - import com.fasterxml.jackson.databind.JavaType; +import org.apache.kafka.common.header.Headers; /** * Determine the {@link JavaType} from the topic/data/headers. diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/AliasPropertiesTests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/AliasPropertiesTests.java index 500b7b02ce..1fbded44a8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/AliasPropertiesTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/AliasPropertiesTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -54,6 +52,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/AsyncListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/AsyncListenerTests.java index 24d668737e..1b90d4e2cc 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/AsyncListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/AsyncListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -27,6 +25,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -45,7 +44,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; @SpringJUnitConfig @DirtiesContext diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversion2Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversion2Tests.java index 5371612e31..af5477e44c 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversion2Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversion2Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2020 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -48,6 +46,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Victor Perez Rey diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversionTests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversionTests.java index 92325625a6..ea124fb3a6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversionTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/BatchListenerConversionTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatNoException; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -74,6 +68,12 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/ContainerFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/ContainerFactoryTests.java index 0c6dc77fd0..030780cc3f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/ContainerFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/ContainerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.Test; @@ -33,6 +30,9 @@ import org.springframework.kafka.support.converter.MessageConverter; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/annotation/EnableKafkaIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/annotation/EnableKafkaIntegrationTests.java index 45ab5a2045..96f3731ea9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/annotation/EnableKafkaIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/annotation/EnableKafkaIntegrationTests.java @@ -16,18 +16,6 @@ package org.springframework.kafka.annotation; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.awaitility.Awaitility.await; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Type; @@ -52,6 +40,13 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; +import io.micrometer.core.instrument.ImmutableTag; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.search.MeterNotFoundException; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Max; import org.aopalliance.intercept.MethodInterceptor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -164,13 +159,17 @@ import org.springframework.validation.Errors; import org.springframework.validation.Validator; -import io.micrometer.core.instrument.ImmutableTag; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Timer; -import io.micrometer.core.instrument.search.MeterNotFoundException; -import io.micrometer.core.instrument.simple.SimpleMeterRegistry; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Max; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.awaitility.Awaitility.await; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; /** * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaListenerEndpointRegistryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaListenerEndpointRegistryTests.java index c9a250ac5a..2150737fb1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaListenerEndpointRegistryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaListenerEndpointRegistryTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -39,6 +33,12 @@ import org.springframework.kafka.listener.ConcurrentMessageListenerContainer; import org.springframework.kafka.listener.MessageListenerContainer; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @author Joo Hyuk Kim diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaStreamsCustomizerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaStreamsCustomizerTests.java index 6d357b6271..18af1eaf27 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaStreamsCustomizerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/KafkaStreamsCustomizerTests.java @@ -16,13 +16,14 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Collections; import java.util.Map; import java.util.Properties; import java.util.concurrent.atomic.AtomicBoolean; +import io.micrometer.core.instrument.ImmutableTag; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.streams.KafkaClientSupplier; @@ -53,9 +54,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import io.micrometer.core.instrument.ImmutableTag; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Nurettin Yilmaz diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/RecordMessagingMessageListenerAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/RecordMessagingMessageListenerAdapterTests.java index 0ba7308bdd..4dbed481ca 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/RecordMessagingMessageListenerAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/RecordMessagingMessageListenerAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -35,6 +33,8 @@ import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory; import org.springframework.messaging.handler.annotation.support.MessageHandlerMethodFactory; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.5 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanInMemoryStateStoreTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanInMemoryStateStoreTests.java index 07185ba917..a2e8163edb 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanInMemoryStateStoreTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanInMemoryStateStoreTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -46,6 +44,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author CĂ©dric Schaller * @author Soby Chacko diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanTests.java index dd0f66efb1..a0fd441738 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryBeanTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -50,6 +46,10 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Pawel Szymczyk * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryLateConfigTests.java b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryLateConfigTests.java index c412f155d9..241ef161f8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryLateConfigTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/config/StreamsBuilderFactoryLateConfigTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.config; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; - import java.util.Properties; import org.apache.kafka.streams.StreamsBuilder; @@ -39,6 +35,10 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; + /** * @author Soby Chacko * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaConsumerFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaConsumerFactoryTests.java index 5cdc3cf8ab..cb6aede96d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaConsumerFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaConsumerFactoryTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.AbstractMap; import java.util.ArrayList; @@ -62,6 +57,11 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Chris Gilbert diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaProducerFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaProducerFactoryTests.java index cfd2d32713..144d42357a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaProducerFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultKafkaProducerFactoryTests.java @@ -16,20 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Collections; @@ -62,6 +48,20 @@ import org.springframework.transaction.CannotCreateTransactionException; import org.springframework.transaction.support.TransactionTemplate; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Adrian Gygax diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultTransactionIdSuffixStrategyTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultTransactionIdSuffixStrategyTests.java index 20256d3dc3..8e928b93ec 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultTransactionIdSuffixStrategyTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/DefaultTransactionIdSuffixStrategyTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatNoException; - import java.util.Map; import java.util.Queue; @@ -27,6 +23,10 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatNoException; + /** * @author Ilya Starchenko * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminBadContextTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminBadContextTests.java index bdf18ceb87..43642878ca 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminBadContextTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminBadContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; - import java.util.HashMap; import java.util.Map; @@ -31,6 +29,8 @@ import org.springframework.kafka.test.EmbeddedKafkaBroker; import org.springframework.kafka.test.EmbeddedKafkaZKBroker; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; + /** * @author Gary Russell * @since 1.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminTests.java index 19c904fcc7..9322e30f59 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaAdminTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.awaitility.Awaitility.await; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collections; @@ -67,6 +61,12 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.ReflectionUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.awaitility.Awaitility.await; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @author Adrian Gygax diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTests.java index 4c31154792..2853eeef1d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTests.java @@ -16,24 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.allOf; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.springframework.kafka.test.assertj.KafkaConditions.key; -import static org.springframework.kafka.test.assertj.KafkaConditions.keyValue; -import static org.springframework.kafka.test.assertj.KafkaConditions.partition; -import static org.springframework.kafka.test.assertj.KafkaConditions.timestamp; -import static org.springframework.kafka.test.assertj.KafkaConditions.value; - import java.time.Duration; import java.util.ArrayList; import java.util.Collections; @@ -97,6 +79,24 @@ import org.springframework.messaging.Message; import org.springframework.messaging.support.MessageBuilder; +import static org.assertj.core.api.Assertions.allOf; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.springframework.kafka.test.assertj.KafkaConditions.key; +import static org.springframework.kafka.test.assertj.KafkaConditions.keyValue; +import static org.springframework.kafka.test.assertj.KafkaConditions.partition; +import static org.springframework.kafka.test.assertj.KafkaConditions.timestamp; +import static org.springframework.kafka.test.assertj.KafkaConditions.value; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTransactionTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTransactionTests.java index 3db8bfa773..641ea558eb 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTransactionTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/KafkaTemplateTransactionTests.java @@ -16,24 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.springframework.kafka.test.assertj.KafkaConditions.key; -import static org.springframework.kafka.test.assertj.KafkaConditions.value; - import java.time.Duration; import java.util.Collections; import java.util.Iterator; @@ -85,6 +67,24 @@ import org.springframework.transaction.support.DefaultTransactionStatus; import org.springframework.transaction.support.TransactionTemplate; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.springframework.kafka.test.assertj.KafkaConditions.key; +import static org.springframework.kafka.test.assertj.KafkaConditions.value; + /** * @author Gary Russell * @author Nakul Mishra diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/RoutingKafkaTemplateTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/RoutingKafkaTemplateTests.java index 608ae2fe68..1db2b0561f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/RoutingKafkaTemplateTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/RoutingKafkaTemplateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -34,6 +26,14 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Nathan Xu diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/TransactionSynchronizationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/TransactionSynchronizationTests.java index 2b0eaea06d..83dec1b12e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/TransactionSynchronizationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/TransactionSynchronizationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,6 @@ package org.springframework.kafka.core; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import org.apache.kafka.clients.producer.Producer; import org.junit.jupiter.api.Test; @@ -34,6 +28,12 @@ import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.transaction.support.TransactionTemplate; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateIntegrationTests.java index bd9f1e9896..abbd12fb0a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.core.reactive; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; - import java.time.Duration; import java.time.Instant; import java.util.AbstractMap.SimpleImmutableEntry; @@ -44,6 +41,16 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.reactivestreams.Subscription; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.kafka.receiver.ReceiverOptions; +import reactor.kafka.receiver.ReceiverRecord; +import reactor.kafka.sender.KafkaSender; +import reactor.kafka.sender.SenderOptions; +import reactor.kafka.sender.SenderRecord; +import reactor.kafka.sender.SenderResult; +import reactor.test.StepVerifier; +import reactor.util.function.Tuple2; import org.springframework.kafka.support.DefaultKafkaHeaderMapper; import org.springframework.kafka.support.KafkaHeaderMapper; @@ -56,16 +63,8 @@ import org.springframework.messaging.MessageHeaders; import org.springframework.messaging.support.MessageBuilder; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.kafka.receiver.ReceiverOptions; -import reactor.kafka.receiver.ReceiverRecord; -import reactor.kafka.sender.KafkaSender; -import reactor.kafka.sender.SenderOptions; -import reactor.kafka.sender.SenderRecord; -import reactor.kafka.sender.SenderResult; -import reactor.test.StepVerifier; -import reactor.util.function.Tuple2; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; /** * @author Mark Norkin diff --git a/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateTransactionIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateTransactionIntegrationTests.java index 5d82eb01a1..48f30db38e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateTransactionIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/core/reactive/ReactiveKafkaProducerTemplateTransactionIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.core.reactive; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; - import java.time.Duration; import java.time.Instant; import java.util.ArrayList; @@ -40,17 +37,6 @@ import org.junit.jupiter.api.TestInfo; import org.reactivestreams.Publisher; import org.reactivestreams.Subscription; - -import org.springframework.core.log.LogAccessor; -import org.springframework.kafka.support.KafkaUtils; -import org.springframework.kafka.support.converter.MessagingMessageConverter; -import org.springframework.kafka.test.condition.EmbeddedKafkaCondition; -import org.springframework.kafka.test.condition.LogLevels; -import org.springframework.kafka.test.condition.LogLevelsCondition; -import org.springframework.kafka.test.context.EmbeddedKafka; -import org.springframework.kafka.test.utils.JUnitUtils; -import org.springframework.kafka.test.utils.KafkaTestUtils; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -63,6 +49,19 @@ import reactor.kafka.sender.internals.DefaultKafkaSender; import reactor.test.StepVerifier; +import org.springframework.core.log.LogAccessor; +import org.springframework.kafka.support.KafkaUtils; +import org.springframework.kafka.support.converter.MessagingMessageConverter; +import org.springframework.kafka.test.condition.EmbeddedKafkaCondition; +import org.springframework.kafka.test.condition.LogLevels; +import org.springframework.kafka.test.condition.LogLevelsCondition; +import org.springframework.kafka.test.context.EmbeddedKafka; +import org.springframework.kafka.test.utils.JUnitUtils; +import org.springframework.kafka.test.utils.KafkaTestUtils; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; + /** * @author Mark Norkin * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ABSwitchClusterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ABSwitchClusterTests.java index 2f6f58b701..afdf0d3d57 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ABSwitchClusterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ABSwitchClusterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; - import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -44,6 +39,11 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.6 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/AbstractConsumerSeekAwareTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/AbstractConsumerSeekAwareTests.java index 2c09187277..bec23890fa 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/AbstractConsumerSeekAwareTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/AbstractConsumerSeekAwareTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - import java.time.Duration; import java.util.Collection; import java.util.List; @@ -51,6 +48,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + /** * @author Borahm Lee * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/AsyncAckAfterHandleTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/AsyncAckAfterHandleTests.java index ab436e457e..d301b72b6b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/AsyncAckAfterHandleTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/AsyncAckAfterHandleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -47,6 +45,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 3.0 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommitOnAssignmentTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommitOnAssignmentTests.java index 226947ed50..20170278ad 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommitOnAssignmentTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommitOnAssignmentTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.withSettings; - import java.time.Duration; import java.util.Collection; import java.util.Collections; @@ -61,6 +50,17 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.withSettings; + /** * @author Gary Russell * @since 2.3.6 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler1Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler1Tests.java index 70ba8c8c69..1ddc1e216c 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler1Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler1Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -60,6 +52,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler2Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler2Tests.java index 543960c2bb..695ae04409 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler2Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler2Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -58,6 +51,13 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler3Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler3Tests.java index 6fba8b9d99..2d9d4ef2c9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler3Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonContainerStoppingErrorHandler3Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.Arrays; import java.util.Collection; @@ -59,6 +51,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonDelegatingErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonDelegatingErrorHandlerTests.java index 225f5b43b3..c994e4a1ea 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonDelegatingErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonDelegatingErrorHandlerTests.java @@ -16,15 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - import java.io.IOException; import java.util.Collections; import java.util.Map; @@ -38,6 +29,15 @@ import org.springframework.kafka.core.KafkaProducerException; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + /** * Tests for {@link CommonDelegatingErrorHandler}. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonMixedErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonMixedErrorHandlerTests.java index 0d6c7bdf26..3ba31798d6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonMixedErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/CommonMixedErrorHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ package org.springframework.kafka.listener; +import org.junit.jupiter.api.Test; + import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import org.junit.jupiter.api.Test; - /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerMockTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerMockTests.java index 0a59a00b8b..8df4c0bea2 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerMockTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerMockTests.java @@ -16,18 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Collection; @@ -74,6 +62,18 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.transaction.support.TransactionSynchronizationManager; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerTests.java index b699f68098..bc0e1044d6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConcurrentMessageListenerContainerTests.java @@ -16,13 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -72,6 +65,13 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.lang.Nullable; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerAwareRebalanceListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerAwareRebalanceListenerTests.java index 5930ea8e72..2044f5cd1a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerAwareRebalanceListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerAwareRebalanceListenerTests.java @@ -16,14 +16,14 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Collection; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.kafka.common.TopicPartition; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Michal Domagala diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerSeekAwareTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerSeekAwareTests.java index 88a17e74e7..67ec34823a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerSeekAwareTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ConsumerSeekAwareTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -34,6 +30,10 @@ import org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Borahm Lee diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerCustomizationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerCustomizationTests.java index ce8f5f368d..73ed759cff 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerCustomizationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerCustomizationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.nio.charset.StandardCharsets; import java.util.stream.Stream; @@ -39,6 +36,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * Tests for container customizations. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerEnforceRebalanceTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerEnforceRebalanceTests.java index 8c6215ec7a..1dd127a24f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerEnforceRebalanceTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerEnforceRebalanceTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - import java.time.Duration; import java.util.Collection; import java.util.concurrent.CountDownLatch; @@ -47,6 +44,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + /** * @author Soby Chacko * @since 3.1.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerGroupSequencerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerGroupSequencerTests.java index 344f79387b..c476913167 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerGroupSequencerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerGroupSequencerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -48,6 +46,8 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.7.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerPauseImmediateTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerPauseImmediateTests.java index f0433f3df2..4d10d6c0fa 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerPauseImmediateTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ContainerPauseImmediateTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -60,6 +52,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeadLetterPublishingRecovererTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeadLetterPublishingRecovererTests.java index 5214ac8cdf..b9da1a86a1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeadLetterPublishingRecovererTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeadLetterPublishingRecovererTests.java @@ -16,23 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willCallRealMethod; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.Collections; import java.util.HashMap; @@ -73,6 +56,23 @@ import org.springframework.kafka.support.serializer.SerializationUtils; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willCallRealMethod; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Tomaz Fernandes diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultAfterRollbackProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultAfterRollbackProcessorTests.java index 5cbf0496dc..2ea0689671 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultAfterRollbackProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultAfterRollbackProcessorTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -50,6 +39,17 @@ import org.springframework.util.backoff.BackOffExecution; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Francois Rosiere diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchIntegrationTests.java index e1b7765283..3d8396ae6e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchIntegrationTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -46,6 +44,8 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; + /** * {@link DefaultErrorHandler} tests for batch listeners. * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchTests.java index c02763451b..00c7c62e21 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerBatchTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +55,18 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * {@link DefaultErrorHandler} tests for batch listeners. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchAckTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchAckTests.java index f66710e395..a1514bdc1c 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchAckTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchAckTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -61,6 +53,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchListenerTests.java index 0af228ae86..c9b5448ac1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksBatchListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -64,6 +55,15 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumeContainerPausedTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumeContainerPausedTests.java index e3df826388..3c322315df 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumeContainerPausedTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumeContainerPausedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -64,6 +53,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumePartitionTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumePartitionTests.java index e57dd10644..3ed9100dc9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumePartitionTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckNoResumePartitionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -66,6 +55,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckTests.java index 6c4fd1d3f5..0dc769b96e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerNoSeeksRecordAckTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +56,17 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerRecordTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerRecordTests.java index 9b82eb8b18..84804d43c5 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerRecordTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerRecordTests.java @@ -16,19 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -50,6 +37,19 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * {@link DefaultErrorHandler} tests for record listeners. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchAckTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchAckTests.java index 84bf2c1cb6..4436e12f3b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchAckTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchAckTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -68,6 +56,18 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchListenerTests.java index 69f8624fbf..55374e805d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionBatchListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -69,6 +58,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionTests.java index 26db166fe8..49afaecda7 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DefaultErrorHandlerSeekAfterCommitExceptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -69,6 +57,18 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerIntegrationTests.java index 20b7cea8fb..58c91cb749 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; @@ -50,6 +47,9 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * @author Sanghyeok An * @since 3.3.0 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerTests.java index 6d79218e2a..184c159e7c 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; @@ -31,6 +29,8 @@ import org.springframework.kafka.support.KafkaHeaders; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Sanghyeok An * @since 3.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingCoverageTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingCoverageTests.java index b0a916bbb0..306746f88b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingCoverageTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingCoverageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,12 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Map; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.9.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingDeserializerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingDeserializerTests.java index e06b309b3f..a30b8519b4 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingDeserializerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingDeserializerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; import java.util.Map; @@ -60,6 +58,8 @@ import org.springframework.validation.Errors; import org.springframework.validation.Validator; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingUtilsTest.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingUtilsTest.java index 0be4a13dcc..96382450a3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingUtilsTest.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ErrorHandlingUtilsTest.java @@ -16,15 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -45,6 +36,15 @@ import org.springframework.util.backoff.BackOff; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; + /** * @author Antonio Tomac * @since 3.0.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ExceptionClassifierTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ExceptionClassifierTests.java index 0ef5688e50..d5165d77f1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ExceptionClassifierTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ExceptionClassifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.8.4 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedBatchProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedBatchProcessorTests.java index 382b6eb944..e9d8a6c4a8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedBatchProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedBatchProcessorTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.util.List; import java.util.Map; import java.util.function.BiConsumer; @@ -46,6 +35,17 @@ import org.springframework.util.backoff.BackOff; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Francois Rosiere diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordProcessorTests.java index 8d72fa9d8d..59585a087f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Collections; import java.util.List; @@ -27,6 +25,8 @@ import org.springframework.kafka.support.TopicPartitionOffset; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3.6 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordTrackerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordTrackerTests.java index c50db09044..700c450c5d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordTrackerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/FailedRecordTrackerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -38,6 +34,10 @@ import org.springframework.util.backoff.BackOffExecution; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.2.5 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerIntegrationTests.java index 5911504f3f..eb9899945b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerIntegrationTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -49,6 +47,8 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerTests.java index 40a9f535d5..53288d6325 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/FallbackBatchErrorHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,21 +16,6 @@ package org.springframework.kafka.listener; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; @@ -52,6 +37,20 @@ import org.springframework.util.ReflectionUtils; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + /** * @author Gary Russell * @since 2.3.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/HeaderMethodArgumentResolverTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/HeaderMethodArgumentResolverTests.java index 88423b6b84..4c85c267db 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/HeaderMethodArgumentResolverTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/HeaderMethodArgumentResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.nio.ByteBuffer; import java.util.Map; @@ -29,6 +27,8 @@ import org.springframework.messaging.handler.invocation.InvocableHandlerMethod; import org.springframework.messaging.support.GenericMessage; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaListenerEndpointRegistryLifecycleTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaListenerEndpointRegistryLifecycleTests.java index 8401db4a06..0ea1ac330d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaListenerEndpointRegistryLifecycleTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaListenerEndpointRegistryLifecycleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.RETURNS_DEEP_STUBS; -import static org.mockito.Mockito.mock; - import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -38,6 +34,10 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; + /** * @author Asi Bross * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java index a3521f6df4..6d961b286b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/KafkaMessageListenerContainerTests.java @@ -16,23 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -131,6 +114,23 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * Tests for the listener container. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerContainerPauseServiceTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerContainerPauseServiceTests.java index 0aa653964a..d3dcf56b59 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerContainerPauseServiceTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerContainerPauseServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.time.Instant; import java.util.concurrent.atomic.AtomicBoolean; @@ -39,6 +29,16 @@ import org.springframework.scheduling.TaskScheduler; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * Unit test for {@link ListenerContainerPauseService}. * diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerErrorHandlerTests.java index 53e2e66a82..b69f93374e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerErrorHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package org.springframework.kafka.listener; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.lang.reflect.Method; import java.util.Collections; import java.util.List; @@ -34,6 +29,11 @@ import org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter; import org.springframework.kafka.support.Acknowledgment; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerUtilsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerUtilsTests.java index ae31c9d5b1..1158763c07 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerUtilsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ListenerUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,13 @@ package org.springframework.kafka.listener; +import org.apache.kafka.clients.consumer.OffsetAndMetadata; +import org.junit.jupiter.api.Test; + import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; -import org.apache.kafka.clients.consumer.OffsetAndMetadata; -import org.junit.jupiter.api.Test; - /** * @author Gary Russell * @author Francois Rosiere diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/LoggingErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/LoggingErrorHandlerTests.java index 56ca58828d..81a2ba29de 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/LoggingErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/LoggingErrorHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -60,6 +49,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAckPartialBatchTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAckPartialBatchTests.java index 10a3e4e979..91c9d5b8f3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAckPartialBatchTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAckPartialBatchTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -63,6 +55,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAssignmentInitialSeekTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAssignmentInitialSeekTests.java index add66d5f06..ebab607e3f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAssignmentInitialSeekTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualAssignmentInitialSeekTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.lang.reflect.Method; import java.time.Duration; import java.util.Arrays; @@ -56,6 +48,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.0.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTests.java index 725d154d4a..6d85836952 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -64,6 +56,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTxTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTxTests.java index 57da7e7867..7ed4b0d0a6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTxTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackBatchTxTests.java @@ -16,16 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -70,6 +60,16 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackPauseResumeTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackPauseResumeTests.java index 7875e57519..fae1db1b77 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackPauseResumeTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackPauseResumeTests.java @@ -16,13 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -65,6 +58,13 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordTests.java index b6e3024e6b..05be09062c 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordTests.java @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -65,6 +57,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordZeroSleepTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordZeroSleepTests.java index 3cb52fbef4..20454460cd 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordZeroSleepTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordZeroSleepTests.java @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -64,6 +56,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8.5 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingGroupIdTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingGroupIdTests.java index 4914fac6c4..0bc4b0eac9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingGroupIdTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingGroupIdTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import java.util.Collections; import org.apache.kafka.clients.consumer.ConsumerConfig; @@ -39,6 +37,8 @@ import org.springframework.kafka.test.condition.EmbeddedKafkaCondition; import org.springframework.kafka.test.context.EmbeddedKafka; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + /** * @author Gary Russell * @since 2.1.5 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicCheckOverrideAdminConfigTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicCheckOverrideAdminConfigTests.java index d6bfef9a25..6ec62b5bf3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicCheckOverrideAdminConfigTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicCheckOverrideAdminConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThatNoException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.util.Map; import java.util.Properties; @@ -37,6 +30,13 @@ import org.springframework.kafka.test.context.EmbeddedKafka; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 3.0 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicsTests.java index 264cf30a82..a8832cc178 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/MissingTopicsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.util.Map; import org.junit.jupiter.api.BeforeAll; @@ -30,6 +27,9 @@ import org.springframework.kafka.test.context.EmbeddedKafka; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * @author Gary Russell * @since 2.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/MockConsumerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/MockConsumerTests.java index ae5c79a465..cff9111046 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/MockConsumerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/MockConsumerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -47,6 +45,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 3.0.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerManualAssignmentTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerManualAssignmentTests.java index 380e96e45e..2f2f9b5eec 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerManualAssignmentTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerManualAssignmentTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -68,6 +57,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerWhileErrorHandlerIsRetryingTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerWhileErrorHandlerIsRetryingTests.java index 7e920052f1..b2e45c2f53 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerWhileErrorHandlerIsRetryingTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/PauseContainerWhileErrorHandlerIsRetryingTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.spy; - import java.time.Duration; import java.util.LinkedHashSet; import java.util.List; @@ -56,6 +50,12 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.spy; + /** * @author Antonio Tomac * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/RemainingRecordsErrorHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/RemainingRecordsErrorHandlerTests.java index a4d7e96ff8..c1a0bc9423 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/RemainingRecordsErrorHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/RemainingRecordsErrorHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -60,6 +52,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.1.12 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTXTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTXTests.java index 4f25f1c5ca..78e70bbc33 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTXTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTXTests.java @@ -16,16 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +57,16 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.0.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTests.java index 90962275a9..78108df7f6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorBatchModeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -61,6 +53,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.0.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTXTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTXTests.java index 1695b0fe05..82fd5a2ebc 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTXTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTXTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -68,6 +57,17 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.0.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTests.java index b4ad2b3731..31bad8b2c3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentOnErrorRecordModeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -63,6 +55,14 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.0.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentRecovererTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentRecovererTests.java index 1c68947dd1..2b4ef419f9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentRecovererTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SeekToCurrentRecovererTests.java @@ -16,19 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - import java.time.Duration; import java.util.ArrayList; import java.util.Collections; @@ -67,6 +54,19 @@ import org.springframework.lang.Nullable; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + /** * @author Gary Russell * @author Soby Chacko diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTests.java index 14750b7d87..a08c8c44b8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +56,17 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + /** * @author Gary Russell * @since 2.3.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxRollbackTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxRollbackTests.java index 0e7c30c32d..851469c1ba 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxRollbackTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxRollbackTests.java @@ -16,16 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +57,16 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxTests.java index 6f8d1fe57a..41d224e3d1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTxTests.java @@ -16,16 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -67,6 +57,16 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.3.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/TestOOMError.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/TestOOMError.java index 29f0bafc94..80c5bf5900 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/TestOOMError.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/TestOOMError.java @@ -16,13 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.Arrays; import java.util.HashMap; @@ -42,6 +35,13 @@ import org.springframework.kafka.listener.ContainerProperties.AckMode; import org.springframework.kafka.support.TopicPartitionOffset; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.1.11 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/TransactionalContainerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/TransactionalContainerTests.java index b71b6c0739..352433fac5 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/TransactionalContainerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/TransactionalContainerTests.java @@ -16,26 +16,6 @@ package org.springframework.kafka.listener; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - import java.time.Duration; import java.util.ArrayList; import java.util.Collection; @@ -98,6 +78,26 @@ import org.springframework.transaction.support.DefaultTransactionDefinition; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchAdapterConversionErrorsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchAdapterConversionErrorsTests.java index 4ac12d81cd..177f97c8b4 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchAdapterConversionErrorsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchAdapterConversionErrorsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -47,6 +43,10 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchListenerWithRecordAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchListenerWithRecordAdapterTests.java index 598703d3dd..e401d52028 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchListenerWithRecordAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchListenerWithRecordAdapterTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.List; @@ -36,6 +33,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @author Soby Chacko diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchMessagingMessageListenerAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchMessagingMessageListenerAdapterTests.java index 40fef84669..cc9a9eaa96 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchMessagingMessageListenerAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/BatchMessagingMessageListenerAdapterTests.java @@ -16,14 +16,6 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -31,6 +23,7 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -46,7 +39,13 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; /** * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/ConvertingMessageListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/ConvertingMessageListenerTests.java index 380248e63f..62afbbb050 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/ConvertingMessageListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/ConvertingMessageListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 the original author or authors. + * Copyright 2016-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,8 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.header.internals.RecordHeader; @@ -38,8 +33,12 @@ import org.springframework.messaging.converter.MessageConversionException; import org.springframework.messaging.converter.MessageConverter; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; /** * @author Adrian Chlebosz diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/FilteringAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/FilteringAdapterTests.java index 17cb070bc5..42c5832beb 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/FilteringAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/FilteringAdapterTests.java @@ -16,14 +16,6 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.only; -import static org.mockito.Mockito.verify; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; @@ -36,6 +28,14 @@ import org.springframework.kafka.listener.BatchAcknowledgingMessageListener; import org.springframework.kafka.support.Acknowledgment; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.only; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/KafkaBackoffAwareMessageListenerAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/KafkaBackoffAwareMessageListenerAdapterTests.java index d411dababa..e77b577340 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/KafkaBackoffAwareMessageListenerAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/KafkaBackoffAwareMessageListenerAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,6 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - import java.math.BigInteger; import java.time.Clock; import java.time.Instant; @@ -50,6 +39,17 @@ import org.springframework.kafka.retrytopic.RetryTopicHeaders; import org.springframework.kafka.support.Acknowledgment; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes diff --git a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapterTests.java index a1c59bc5f0..5b879781ad 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/listener/adapter/MessagingMessageListenerAdapterTests.java @@ -16,20 +16,12 @@ package org.springframework.kafka.listener.adapter; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.lang.reflect.Method; import java.util.concurrent.CompletableFuture; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.kafka.annotation.KafkaListenerAnnotationBeanPostProcessor; import org.springframework.kafka.listener.AcknowledgingMessageListener; @@ -38,7 +30,14 @@ import org.springframework.kafka.support.converter.RecordMessageConverter; import org.springframework.messaging.support.GenericMessage; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; /** * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/requestreply/CorrelationKeyTests.java b/spring-kafka/src/test/java/org/springframework/kafka/requestreply/CorrelationKeyTests.java index b6ba59a105..f3598c55b6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/requestreply/CorrelationKeyTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/requestreply/CorrelationKeyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.requestreply; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.8.10 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/requestreply/ReplyingKafkaTemplateTests.java b/spring-kafka/src/test/java/org/springframework/kafka/requestreply/ReplyingKafkaTemplateTests.java index 9dcd2af69c..c587ac53a2 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/requestreply/ReplyingKafkaTemplateTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/requestreply/ReplyingKafkaTemplateTests.java @@ -16,15 +16,6 @@ package org.springframework.kafka.requestreply; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.nio.ByteBuffer; import java.time.Duration; import java.util.ArrayList; @@ -98,6 +89,15 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Nathan Xu diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicClassLevelIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicClassLevelIntegrationTests.java index 6468b91bbc..974434b567 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicClassLevelIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicClassLevelIntegrationTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.awaitility.Awaitility.await; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -84,6 +80,10 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.awaitility.Awaitility.await; + /** * @author Sanghyeok An * @since 3.3.0 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicScenarioTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicScenarioTests.java index a4db2790c6..b331b98b34 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicScenarioTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncCompletableFutureRetryTopicScenarioTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -62,6 +59,9 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * @author Sanghyeok An * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoFutureRetryTopicClassLevelIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoFutureRetryTopicClassLevelIntegrationTests.java index ec9f1cca24..64ef40cded 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoFutureRetryTopicClassLevelIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoFutureRetryTopicClassLevelIntegrationTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.awaitility.Awaitility.await; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -42,6 +38,7 @@ import org.apache.kafka.common.serialization.StringSerializer; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -83,7 +80,9 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.awaitility.Awaitility.await; /** * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoRetryTopicScenarioTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoRetryTopicScenarioTests.java index a1ca877b89..d3c80bf2cd 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoRetryTopicScenarioTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/AsyncMonoRetryTopicScenarioTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -29,6 +26,7 @@ import org.apache.kafka.clients.producer.ProducerConfig; import org.apache.kafka.common.serialization.StringSerializer; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -61,7 +59,8 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; /** * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/BackOffValuesGeneratorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/BackOffValuesGeneratorTests.java index 2e3b7abb67..2fd2257653 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/BackOffValuesGeneratorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/BackOffValuesGeneratorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Arrays; import java.util.List; @@ -27,6 +25,8 @@ import org.springframework.retry.backoff.ExponentialBackOffPolicy; import org.springframework.retry.backoff.NoBackOffPolicy; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Tomaz Fernandes * @since 2.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/CircularDltHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/CircularDltHandlerTests.java index 4cb6820080..6921b22991 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/CircularDltHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/CircularDltHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.mockito.Mockito.mock; - import org.junit.jupiter.api.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; @@ -31,6 +29,8 @@ import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeadLetterPublishingRecovererFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeadLetterPublishingRecovererFactoryTests.java index e059f8e091..954b024afb 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeadLetterPublishingRecovererFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeadLetterPublishingRecovererFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,20 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; - import java.math.BigInteger; import java.nio.ByteBuffer; import java.time.Clock; @@ -64,6 +50,20 @@ import org.springframework.kafka.support.KafkaHeaders; import org.springframework.kafka.test.condition.LogLevels; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicProcessorTests.java index 8efea11c1a..f08fd60faf 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.then; -import static org.mockito.Mockito.times; - import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -32,6 +27,11 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicResolverTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicResolverTests.java index 13e8bd16f9..cd584a3c8e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicResolverTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DefaultDestinationTopicResolverTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.assertj.core.api.Assertions.assertThatNullPointerException; - import java.time.Clock; import java.time.Instant; import java.util.Arrays; @@ -41,6 +36,11 @@ import org.springframework.kafka.support.converter.ConversionException; import org.springframework.kafka.support.serializer.DeserializationException; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.assertj.core.api.Assertions.assertThatNullPointerException; + /** * @author Tomaz Fernandes * @author Yvette Quinby diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeliveryHeaderTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeliveryHeaderTests.java index 686413c935..0c4bac4498 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeliveryHeaderTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DeliveryHeaderTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CountDownLatch; @@ -53,6 +51,8 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; + /** * Test delivery header, since 3.2 support class level {@link RetryableTopic}. * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DestinationTopicPropertiesFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DestinationTopicPropertiesFactoryTests.java index a93322460c..a2d9e5122e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DestinationTopicPropertiesFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DestinationTopicPropertiesFactoryTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Collections; import java.util.List; import java.util.Map; @@ -38,6 +36,8 @@ import org.springframework.retry.backoff.ExponentialBackOffPolicy; import org.springframework.retry.backoff.FixedBackOffPolicy; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Tomaz Fernandes * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DltStartupTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DltStartupTests.java index fd1b1857ce..e1e91a85ea 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DltStartupTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/DltStartupTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.util.Map; import org.apache.kafka.clients.admin.AdminClientConfig; @@ -44,6 +41,9 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * Verify that autoStartDltHandler overrides factory autoStartup (for both factory * settings). diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/EndpointCustomizerFactoryTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/EndpointCustomizerFactoryTests.java index a7dbcb6793..f4c83c9fd3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/EndpointCustomizerFactoryTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/EndpointCustomizerFactoryTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; @@ -40,6 +36,10 @@ import org.springframework.kafka.support.EndpointHandlerMultiMethod; import org.springframework.kafka.support.TopicPartitionOffset; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Tomaz Fernandes * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicClassLevelIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicClassLevelIntegrationTests.java index fa3e5d4a58..fd37a1232d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicClassLevelIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicClassLevelIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.time.Clock; import java.util.HashMap; import java.util.Map; @@ -63,6 +60,9 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * Tests for ... diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicIntegrationTests.java index d7e6bb72b4..12d0764fea 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ExistingRetryTopicIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.time.Clock; import java.util.HashMap; import java.util.Map; @@ -64,6 +61,9 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * Tests for https://github.com/spring-projects/spring-kafka/issues/1828 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurerTests.java index b574917554..419f2fe7ab 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurerTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - import java.math.BigInteger; import java.time.Clock; import java.time.Instant; @@ -65,6 +54,17 @@ import org.springframework.util.backoff.BackOffExecution; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryResolverTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryResolverTests.java index b3f8129dd1..b7a1633636 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryResolverTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryResolverTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.Mockito.times; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; @@ -30,6 +24,12 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @since 2.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/PartitionResolverTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/PartitionResolverTests.java index 4aa43135cf..94c752fb01 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/PartitionResolverTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/PartitionResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2022 the original author or authors. + * Copyright 2022-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; @@ -52,6 +46,12 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.9.2 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelExceptionRoutingIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelExceptionRoutingIntegrationTests.java index 6855b28c5f..ddc40f494b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelExceptionRoutingIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelExceptionRoutingIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.util.HashMap; import java.util.List; import java.util.Map; @@ -62,6 +59,9 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * Test class level non-blocking retries. diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java index 86ab638f19..910ea0f48e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicClassLevelIntegrationTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.awaitility.Awaitility.await; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -88,6 +84,10 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.awaitility.Awaitility.await; + /** * Test class level non-blocking retries. diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationBuilderTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationBuilderTests.java index 990fe99e34..b6cfc0fc0f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationBuilderTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2023 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Arrays; import java.util.List; import java.util.Map; @@ -34,6 +32,8 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.test.util.ReflectionTestUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Tomaz Fernandes * @author Adrian Chlebosz diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationIntegrationTests.java index 2ad2ab8c35..3abd651735 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -59,6 +55,10 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @since 2.7.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationManualAssignmentIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationManualAssignmentIntegrationTests.java index 1c282bbdbf..87618b70cf 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationManualAssignmentIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationManualAssignmentIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.awaitility.Awaitility.await; - import java.time.Duration; import java.util.List; import java.util.Map; @@ -53,6 +50,9 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + /** * @author Gary Russell * @since 2.7.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationProviderTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationProviderTests.java index bf621042c4..6d12e5f8c9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationProviderTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationProviderTests.java @@ -16,15 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Method; @@ -41,6 +32,15 @@ import org.springframework.kafka.annotation.RetryableTopic; import org.springframework.kafka.core.KafkaOperations; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationSupportTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationSupportTests.java index 3928408aed..a066566a37 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationSupportTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurationSupportTests.java @@ -16,17 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.time.Clock; import java.util.LinkedHashMap; import java.util.List; @@ -53,6 +42,17 @@ import org.springframework.scheduling.TaskScheduler; import org.springframework.util.backoff.BackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurerTests.java index 37c70df272..3f5536798f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConfigurerTests.java @@ -16,15 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.then; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -57,6 +48,15 @@ import org.springframework.kafka.test.condition.LogLevels; import org.springframework.test.util.ReflectionTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.then; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; + /** * @author Tomaz Fernandes * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConstantsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConstantsTests.java index 6181124420..841572bd27 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConstantsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicConstantsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Tomaz Fernandes * @since 2.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicExceptionRoutingIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicExceptionRoutingIntegrationTests.java index 5084ba44e8..93b0a34b1d 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicExceptionRoutingIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicExceptionRoutingIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - import java.util.HashMap; import java.util.List; import java.util.Map; @@ -63,6 +60,9 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + /** * @author Tomaz Fernandes diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicHeadersTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicHeadersTests.java index c07e3e84cb..89045bbde3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicHeadersTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicHeadersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2021 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,10 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Tomaz Fernandes * @since 2.7 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java index 8cc23e880d..15104b0829 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicIntegrationTests.java @@ -16,10 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.awaitility.Awaitility.await; - import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; @@ -89,6 +85,10 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.awaitility.Awaitility.await; + /** * @author Tomaz Fernandes diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicSameContainerFactoryIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicSameContainerFactoryIntegrationTests.java index 95608a2b28..73257f8dd1 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicSameContainerFactoryIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryTopicSameContainerFactoryIntegrationTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -59,6 +54,11 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.backoff.FixedBackOff; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; + /** * @author Tomaz Fernandes * @author Cenk Akin diff --git a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryableTopicAnnotationProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryableTopicAnnotationProcessorTests.java index 6ab21b0ee2..817f332fff 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryableTopicAnnotationProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/retrytopic/RetryableTopicAnnotationProcessorTests.java @@ -16,14 +16,6 @@ package org.springframework.kafka.retrytopic; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.mock; - import java.lang.reflect.Method; import java.util.List; import java.util.stream.Stream; @@ -52,6 +44,14 @@ import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.ReflectionUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.mock; + /** * @author Tomaz Fernandes * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/security/jaas/KafkaJaasLoginModuleInitializerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/security/jaas/KafkaJaasLoginModuleInitializerTests.java index c42867e089..a649cddbe8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/security/jaas/KafkaJaasLoginModuleInitializerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/security/jaas/KafkaJaasLoginModuleInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.security.jaas; -import static org.assertj.core.api.Assertions.assertThat; - import java.io.IOException; import java.util.Collections; import java.util.HashMap; @@ -26,6 +24,7 @@ import javax.security.auth.login.AppConfigurationEntry; +import com.sun.security.auth.login.ConfigFile; import org.apache.kafka.common.security.JaasContext; import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.Test; @@ -38,7 +37,7 @@ import org.springframework.kafka.security.jaas.KafkaJaasLoginModuleInitializer.ControlFlag; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.sun.security.auth.login.ConfigFile; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Marius Bogoevici diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer1Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer1Tests.java index b4dd39b00f..16faaec2f3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer1Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer1Tests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -44,6 +42,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer2Tests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer2Tests.java index 8a52eea463..27fc7a9ed9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer2Tests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/Configurer2Tests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -44,6 +42,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/HeaderEnricherProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/HeaderEnricherProcessorTests.java index 7f5c2f92cc..1823e2defe 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/HeaderEnricherProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/HeaderEnricherProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -38,6 +36,8 @@ import org.springframework.expression.common.LiteralExpression; import org.springframework.expression.spel.standard.SpelExpressionParser; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsBranchTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsBranchTests.java index c6e5486e89..6dcb606c38 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsBranchTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsBranchTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -53,6 +51,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Elliot Kennedy * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsInteractiveQueryServiceTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsInteractiveQueryServiceTests.java index afcd2829de..67c0def9d9 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsInteractiveQueryServiceTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsInteractiveQueryServiceTests.java @@ -16,13 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.lang.reflect.Field; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -76,6 +69,13 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Soby Chacko * @author Sanghyeok An diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsJsonSerializationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsJsonSerializationTests.java index a919ea5981..3e208f08dd 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsJsonSerializationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsJsonSerializationTests.java @@ -16,11 +16,11 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Map; import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -55,8 +55,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Elliot Kennedy diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsTests.java index 58372857ff..11e9a66d20 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/KafkaStreamsTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.time.Duration; import java.util.HashMap; import java.util.Map; @@ -28,6 +25,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import kafka.server.BrokerServer; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.serialization.Serdes; import org.apache.kafka.streams.KafkaStreams; @@ -75,7 +73,8 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import kafka.server.BrokerServer; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; /** * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandlerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandlerTests.java index 4ab43aa63d..0a6b1ded99 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandlerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/RecoveringDeserializationExceptionHandlerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.streams; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -67,6 +65,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Soby Chacko diff --git a/spring-kafka/src/test/java/org/springframework/kafka/streams/messaging/MessagingProcessorTests.java b/spring-kafka/src/test/java/org/springframework/kafka/streams/messaging/MessagingProcessorTests.java index 0ef2fffeb4..4f8aad95aa 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/streams/messaging/MessagingProcessorTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/streams/messaging/MessagingProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.streams.messaging; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Collections; import java.util.Properties; @@ -41,6 +39,8 @@ import org.springframework.kafka.support.converter.MessagingMessageConverter; import org.springframework.messaging.support.MessageBuilder; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/DefaultKafkaHeaderMapperTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/DefaultKafkaHeaderMapperTests.java index adb56002fe..598b08b084 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/DefaultKafkaHeaderMapperTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/DefaultKafkaHeaderMapperTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - import java.net.URI; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -48,6 +45,9 @@ import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetriesTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetriesTests.java index 8c6949a75b..6af6a203be 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetriesTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/ExponentialBackOffWithMaxRetriesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; - import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; @@ -27,6 +24,9 @@ import org.springframework.util.backoff.BackOffExecution; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; + /** * @author Gary Russell * @since 2.7.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/KafkaStreamBrancherTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/KafkaStreamBrancherTests.java index 1717d273ce..215eb85764 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/KafkaStreamBrancherTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/KafkaStreamBrancherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,18 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - import java.util.concurrent.atomic.AtomicInteger; import org.apache.kafka.streams.kstream.KStream; import org.apache.kafka.streams.kstream.Predicate; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + /** * @author Ivan Ponomarev * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/LogIfLevelEnabledTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/LogIfLevelEnabledTests.java index 597f199678..9da1a72a07 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/LogIfLevelEnabledTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/LogIfLevelEnabledTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,18 @@ package org.springframework.kafka.support; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.withSettings; - import java.util.function.Supplier; import org.junit.jupiter.api.Test; import org.springframework.core.log.LogAccessor; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.withSettings; + /** * @author Gary Russell * @since 2.2.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/LoggingProducerListenerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/LoggingProducerListenerTests.java index 83220be1d2..20cc10fb9e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/LoggingProducerListenerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/LoggingProducerListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 the original author or authors. + * Copyright 2021-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,6 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.Mockito.spy; - import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; @@ -31,6 +26,11 @@ import org.springframework.core.log.LogAccessor; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.Mockito.spy; + /** * @author Gary Russell * @since 2.5.16 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/SimpleKafkaHeaderMapperTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/SimpleKafkaHeaderMapperTests.java index 77caa3d81a..9b19bfda6b 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/SimpleKafkaHeaderMapperTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/SimpleKafkaHeaderMapperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2022 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +16,6 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.assertj.core.api.Assertions.entry; - import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; @@ -32,6 +28,10 @@ import org.springframework.messaging.MessageHeaders; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.assertj.core.api.Assertions.entry; + /** * @author Gary Russell * @since 2.2.5 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/TopicPartitionOffsetTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/TopicPartitionOffsetTests.java index 1ad0d983b5..b8aab7914a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/TopicPartitionOffsetTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/TopicPartitionOffsetTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.support; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Objects; import org.apache.kafka.common.TopicPartition; @@ -25,6 +23,8 @@ import org.springframework.kafka.support.TopicPartitionOffset.SeekPosition; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3.13 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/BatchMessageConverterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/BatchMessageConverterTests.java index 1e7921194a..0d3ee939ee 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/BatchMessageConverterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/BatchMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 the original author or authors. + * Copyright 2017-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ package org.springframework.kafka.support.converter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -42,6 +39,9 @@ import org.springframework.messaging.Message; import org.springframework.messaging.MessageHeaders; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * @author Biju Kunjummen * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/MessagingMessageConverterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/MessagingMessageConverterTests.java index 2386881e18..64abf4f1b8 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/MessagingMessageConverterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/MessagingMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.kafka.support.converter; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.Arrays; import java.util.Collection; import java.util.Map; @@ -40,6 +38,8 @@ import org.springframework.messaging.support.GenericMessage; import org.springframework.util.MimeType; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/ProjectingMessageConverterTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/ProjectingMessageConverterTests.java index dd17646d99..fc994c6c75 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/converter/ProjectingMessageConverterTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/converter/ProjectingMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 the original author or authors. + * Copyright 2018-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,15 +16,11 @@ package org.springframework.kafka.support.converter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.mockito.Mockito.doReturn; - import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; +import com.jayway.jsonpath.DocumentContext; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.common.utils.Bytes; import org.junit.jupiter.api.Test; @@ -37,7 +33,10 @@ import org.springframework.kafka.support.KafkaNull; import org.springframework.messaging.support.MessageBuilder; -import com.jayway.jsonpath.DocumentContext; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.mockito.Mockito.doReturn; /** * @author Oliver Gierke diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/MicrometerHolderTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/MicrometerHolderTests.java index 4ee64bcf00..73efecdd1e 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/MicrometerHolderTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/MicrometerHolderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 the original author or authors. + * Copyright 2020-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,18 +16,12 @@ package org.springframework.kafka.support.micrometer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - import java.util.Collections; import java.util.Map; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.ObjectProvider; @@ -37,9 +31,14 @@ import org.springframework.context.annotation.Primary; import org.springframework.test.util.ReflectionTestUtils; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.Timer; -import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; /** * @author Vasyl Sarzhynskyi diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationIntegrationTests.java index f6bb633568..4718c75b5f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationIntegrationTests.java @@ -16,14 +16,20 @@ package org.springframework.kafka.support.micrometer; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import io.micrometer.common.KeyValues; +import io.micrometer.core.tck.MeterRegistryAssert; +import io.micrometer.observation.ObservationRegistry; +import io.micrometer.tracing.Span.Kind; +import io.micrometer.tracing.exporter.FinishedSpan; +import io.micrometer.tracing.test.SampleTestRunner; +import io.micrometer.tracing.test.simple.SpanAssert; +import io.micrometer.tracing.test.simple.SpansAssert; import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -43,14 +49,7 @@ import org.springframework.kafka.test.EmbeddedKafkaZKBroker; import org.springframework.kafka.test.utils.KafkaTestUtils; -import io.micrometer.common.KeyValues; -import io.micrometer.core.tck.MeterRegistryAssert; -import io.micrometer.observation.ObservationRegistry; -import io.micrometer.tracing.Span.Kind; -import io.micrometer.tracing.exporter.FinishedSpan; -import io.micrometer.tracing.test.SampleTestRunner; -import io.micrometer.tracing.test.simple.SpanAssert; -import io.micrometer.tracing.test.simple.SpansAssert; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationTests.java index d5e78c7dd8..ce9acf3de2 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/micrometer/ObservationTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.support.micrometer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.awaitility.Awaitility.await; -import static org.mockito.Mockito.mock; - import java.util.Arrays; import java.util.Deque; import java.util.List; @@ -32,6 +27,23 @@ import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicReference; +import io.micrometer.common.KeyValues; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.observation.DefaultMeterObservationHandler; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import io.micrometer.core.tck.MeterRegistryAssert; +import io.micrometer.observation.ObservationHandler; +import io.micrometer.observation.ObservationRegistry; +import io.micrometer.observation.tck.TestObservationRegistry; +import io.micrometer.tracing.Span; +import io.micrometer.tracing.TraceContext; +import io.micrometer.tracing.Tracer; +import io.micrometer.tracing.handler.DefaultTracingObservationHandler; +import io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler; +import io.micrometer.tracing.handler.PropagatingSenderTracingObservationHandler; +import io.micrometer.tracing.propagation.Propagator; +import io.micrometer.tracing.test.simple.SimpleSpan; +import io.micrometer.tracing.test.simple.SimpleTracer; import org.apache.kafka.clients.admin.AdminClientConfig; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; @@ -43,6 +55,7 @@ import org.apache.kafka.common.header.Header; import org.apache.kafka.common.header.Headers; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -71,24 +84,10 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.util.StringUtils; -import io.micrometer.common.KeyValues; -import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.core.instrument.observation.DefaultMeterObservationHandler; -import io.micrometer.core.instrument.simple.SimpleMeterRegistry; -import io.micrometer.core.tck.MeterRegistryAssert; -import io.micrometer.observation.ObservationHandler; -import io.micrometer.observation.ObservationRegistry; -import io.micrometer.observation.tck.TestObservationRegistry; -import io.micrometer.tracing.Span; -import io.micrometer.tracing.TraceContext; -import io.micrometer.tracing.Tracer; -import io.micrometer.tracing.handler.DefaultTracingObservationHandler; -import io.micrometer.tracing.handler.PropagatingReceiverTracingObservationHandler; -import io.micrometer.tracing.handler.PropagatingSenderTracingObservationHandler; -import io.micrometer.tracing.propagation.Propagator; -import io.micrometer.tracing.test.simple.SimpleSpan; -import io.micrometer.tracing.test.simple.SimpleTracer; -import reactor.core.publisher.Mono; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.awaitility.Awaitility.await; +import static org.mockito.Mockito.mock; /** * @author Gary Russell diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingByTopicSerializationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingByTopicSerializationTests.java index f280d8e1ab..052bb63d1f 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingByTopicSerializationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingByTopicSerializationTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; - import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; @@ -32,6 +30,8 @@ import org.apache.kafka.common.serialization.StringSerializer; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingSerializationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingSerializationTests.java index 9cd6a60ea2..ee257fffb4 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingSerializationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/DelegatingSerializationTests.java @@ -16,12 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - import java.nio.ByteBuffer; import java.util.Collections; import java.util.HashMap; @@ -45,6 +39,12 @@ import org.springframework.kafka.support.DefaultKafkaHeaderMapper; import org.springframework.messaging.MessageHeaders; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Artem Bilan diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerdeTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerdeTests.java index de6012babb..41806c4fbb 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerdeTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerdeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 the original author or authors. + * Copyright 2019-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,13 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.jupiter.api.Test; import org.springframework.kafka.support.mapping.AbstractJavaTypeMapper; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @since 2.3 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerializationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerializationTests.java index a2280488a5..8510437e27 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerializationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/JsonSerializationTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.assertj.core.api.Assertions.assertThatIllegalStateException; - import java.io.IOException; import java.util.Arrays; import java.util.Collections; @@ -30,6 +25,15 @@ import java.util.Objects; import java.util.Set; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; import org.apache.kafka.common.errors.SerializationException; import org.apache.kafka.common.header.Headers; import org.apache.kafka.common.header.internals.RecordHeaders; @@ -45,15 +49,10 @@ import org.springframework.kafka.support.serializer.testentities.DummyEntity; import org.springframework.kafka.test.utils.KafkaTestUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.type.TypeFactory; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; /** * @author Igor Stepanov diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/RetryingDeserializerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/RetryingDeserializerTests.java index fb1d3846d1..09e5a92c1a 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/RetryingDeserializerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/RetryingDeserializerTests.java @@ -16,11 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Map; @@ -35,6 +30,11 @@ import org.springframework.retry.RetryContext; import org.springframework.retry.support.RetryTemplate; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + /** * @author Gary Russell * @author Wang Zhiyang diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationIntegrationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationIntegrationTests.java index dc819ea957..835bfa38f6 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationIntegrationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationIntegrationTests.java @@ -16,9 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - import java.util.Map; import java.util.regex.Pattern; @@ -35,6 +32,9 @@ import org.springframework.kafka.test.context.EmbeddedKafka; import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + /** * @author Gary Russell * @since 2.8.1 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationUtilsTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationUtilsTests.java index ead2dbc401..92654833f5 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationUtilsTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/SerializationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2023 the original author or authors. + * Copyright 2023-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.BDDMockito.given; -import static org.mockito.BDDMockito.willAnswer; -import static org.mockito.BDDMockito.willReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; - import java.util.List; import java.util.function.Supplier; @@ -35,6 +28,13 @@ import org.springframework.core.log.LogAccessor; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willAnswer; +import static org.mockito.BDDMockito.willReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; + /** * @author Gary Russell * @since 2.9.11 diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/StringOrBytesSerializerTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/StringOrBytesSerializerTests.java index ab123bed43..2a8a5b28ef 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/StringOrBytesSerializerTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/StringOrBytesSerializerTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; - import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Map; @@ -27,6 +25,8 @@ import org.springframework.kafka.test.utils.KafkaTestUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Gary Russell * @author Soby Chacko diff --git a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/ToStringSerializationTests.java b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/ToStringSerializationTests.java index f19a9150fb..3e86d310e3 100644 --- a/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/ToStringSerializationTests.java +++ b/spring-kafka/src/test/java/org/springframework/kafka/support/serializer/ToStringSerializationTests.java @@ -16,8 +16,6 @@ package org.springframework.kafka.support.serializer; -import static org.assertj.core.api.Assertions.assertThat; - import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Collections; @@ -32,6 +30,8 @@ import org.springframework.kafka.support.serializer.testentities.DummyEntity; import org.springframework.lang.Nullable; +import static org.assertj.core.api.Assertions.assertThat; + /** * * @author Alexei Klenin diff --git a/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinCoroutinesTests.kt b/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinCoroutinesTests.kt index aaf1f079d3..ec60d2bd02 100644 --- a/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinCoroutinesTests.kt +++ b/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinCoroutinesTests.kt @@ -29,18 +29,13 @@ import org.springframework.kafka.annotation.EnableKafka import org.springframework.kafka.annotation.KafkaHandler import org.springframework.kafka.annotation.KafkaListener import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory -import org.springframework.kafka.core.ConsumerFactory -import org.springframework.kafka.core.DefaultKafkaConsumerFactory -import org.springframework.kafka.core.DefaultKafkaProducerFactory -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.core.* import org.springframework.kafka.listener.KafkaListenerErrorHandler import org.springframework.kafka.test.EmbeddedKafkaBroker import org.springframework.kafka.test.context.EmbeddedKafka import org.springframework.messaging.handler.annotation.SendTo import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.junit.jupiter.SpringJUnitConfig -import java.lang.Exception import java.time.Duration import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit diff --git a/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinTests.kt b/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinTests.kt index 11c46c01c4..a5e8d0fbab 100644 --- a/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinTests.kt +++ b/spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinTests.kt @@ -30,18 +30,13 @@ import org.springframework.context.annotation.Configuration import org.springframework.kafka.annotation.EnableKafka import org.springframework.kafka.annotation.KafkaListener import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory -import org.springframework.kafka.core.ConsumerFactory -import org.springframework.kafka.core.DefaultKafkaConsumerFactory -import org.springframework.kafka.core.DefaultKafkaProducerFactory -import org.springframework.kafka.core.KafkaTemplate -import org.springframework.kafka.core.ProducerFactory +import org.springframework.kafka.core.* import org.springframework.kafka.listener.* import org.springframework.kafka.support.converter.JsonMessageConverter import org.springframework.kafka.test.EmbeddedKafkaBroker import org.springframework.kafka.test.context.EmbeddedKafka import org.springframework.test.annotation.DirtiesContext import org.springframework.test.context.junit.jupiter.SpringJUnitConfig -import java.lang.Exception import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index d746bba59a..59b4ecaf28 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -97,13 +97,12 @@ - + - + -