From c791509c10a72b9217c716296df72b7c9c892db1 Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Fri, 18 Oct 2024 15:39:13 -0400 Subject: [PATCH] Optimize imports --- .../kafka/test/EmbeddedKafkaKraftBroker.java | 7 +++---- .../kafka/test/EmbeddedKafkaKraftBrokerTests.java | 4 ++-- .../kafka/test/EmbeddedKafkaZKBrokerTests.java | 4 ++-- .../kafka/test/assertj/KafkaConditionsTests.java | 6 +++--- .../condition/EmbeddedKafkaConditionTests.java | 4 ++-- .../condition/WithNestedClassContextTests.java | 4 ++-- .../test/condition/WithSpringTestContextTests.java | 4 ++-- .../EmbeddedKafkaContextCustomizerTests.java | 4 ++-- .../kafka/test/hamcrest/KafkaMatchersTests.java | 14 +++++++------- ...balEmbeddedKafkaTestExecutionListenerTests.java | 4 ++-- .../test/rule/AddressableEmbeddedBrokerTests.java | 4 ++-- .../kafka/test/utils/KafkaTestUtilsTests.java | 6 +++--- 12 files changed, 32 insertions(+), 33 deletions(-) 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 e5635fbd9c..2d53612e5c 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/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java b/spring-kafka-test/src/test/java/org/springframework/kafka/test/EmbeddedKafkaKraftBrokerTests.java index 86766caa2e..f1be0ac0ba 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 @@ -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..7d0fa1cd86 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 @@ -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..e62a8d6dd4 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 @@ -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..60ca365d08 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 @@ -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..e5b294af79 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 @@ -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..8c2fe99c2a 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 @@ -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..37863b11a6 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 @@ -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..243a9e65b7 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 @@ -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