From e22c2e568706d6bfa02d80f353e872c72374524e Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Tue, 30 Apr 2019 15:18:18 +0900 Subject: [PATCH] Polish Closes gh-16685 --- .../kafka/KafkaAutoConfigurationTests.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java index a783cf1d45..b6a92d4992 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/kafka/KafkaAutoConfigurationTests.java @@ -62,7 +62,6 @@ import org.springframework.kafka.support.converter.BatchMessageConverter; import org.springframework.kafka.support.converter.BatchMessagingMessageConverter; import org.springframework.kafka.support.converter.MessagingMessageConverter; import org.springframework.kafka.support.converter.RecordMessageConverter; -import org.springframework.kafka.test.utils.KafkaTestUtils; import org.springframework.kafka.transaction.ChainedKafkaTransactionManager; import org.springframework.kafka.transaction.KafkaAwareTransactionManager; import org.springframework.kafka.transaction.KafkaTransactionManager; @@ -285,8 +284,8 @@ public class KafkaAutoConfigurationTests { .isEmpty(); assertThat(configs.get("foo.bar.baz")).isEqualTo("qux.fiz.buz"); assertThat(configs.get("fiz.buz")).isEqualTo("fix.fox"); - assertThat(KafkaTestUtils.getPropertyValue(admin, - "fatalIfBrokerNotAvailable", Boolean.class)).isTrue(); + assertThat(admin).hasFieldOrPropertyWithValue( + "fatalIfBrokerNotAvailable", true); }); } @@ -577,8 +576,8 @@ public class KafkaAutoConfigurationTests { .run((context) -> { ConcurrentKafkaListenerContainerFactory factory = context .getBean(ConcurrentKafkaListenerContainerFactory.class); - assertThat(KafkaTestUtils.getPropertyValue(factory, "errorHandler")) - .isSameAs(context.getBean("errorHandler")); + assertThat(factory).hasFieldOrPropertyWithValue("errorHandler", + context.getBean("errorHandler")); }); } @@ -588,8 +587,8 @@ public class KafkaAutoConfigurationTests { .withPropertyValues("spring.kafka.listener.type=batch").run((context) -> { ConcurrentKafkaListenerContainerFactory factory = context .getBean(ConcurrentKafkaListenerContainerFactory.class); - assertThat(KafkaTestUtils.getPropertyValue(factory, "errorHandler")) - .isSameAs(context.getBean("batchErrorHandler")); + assertThat(factory).hasFieldOrPropertyWithValue("errorHandler", + context.getBean("batchErrorHandler")); }); } @@ -599,8 +598,7 @@ public class KafkaAutoConfigurationTests { .run((context) -> { ConcurrentKafkaListenerContainerFactory factory = context .getBean(ConcurrentKafkaListenerContainerFactory.class); - assertThat(KafkaTestUtils.getPropertyValue(factory, "errorHandler")) - .isNull(); + assertThat(factory).hasFieldOrPropertyWithValue("errorHandler", null); }); } @@ -610,8 +608,7 @@ public class KafkaAutoConfigurationTests { .withUserConfiguration(ErrorHandlerConfiguration.class).run((context) -> { ConcurrentKafkaListenerContainerFactory factory = context .getBean(ConcurrentKafkaListenerContainerFactory.class); - assertThat(KafkaTestUtils.getPropertyValue(factory, "errorHandler")) - .isNull(); + assertThat(factory).hasFieldOrPropertyWithValue("errorHandler", null); }); }