From 696376c72877f9da621628770532089cdf127c36 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 19 Oct 2016 17:29:02 -0400 Subject: [PATCH] Downgrade to AssertJ 2.5 for Boot compatibility See https://github.com/spring-projects/spring-kafka/issues/196 --- .../xml/KafkaOutboundAdapterParserTests.java | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java index 3c16c141f3..dbf468cc8d 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/config/xml/KafkaOutboundAdapterParserTests.java @@ -17,7 +17,7 @@ package org.springframework.integration.kafka.config.xml; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import java.util.concurrent.ExecutionException; @@ -102,18 +102,28 @@ public class KafkaOutboundAdapterParserTests { return null; }); - assertThatExceptionOfType(MessageHandlingException.class) - .isThrownBy(() -> handler.handleMessage(new GenericMessage<>("foo"))) - .withMessageContaining("Async Producer Mock exception") - .withCauseExactlyInstanceOf(ExecutionException.class) - .withRootCauseExactlyInstanceOf(RuntimeException.class); + try { + handler.handleMessage(new GenericMessage<>("foo")); + fail("MessageHandlingException expected"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(MessageHandlingException.class); + assertThat(e.getCause()).isExactlyInstanceOf(ExecutionException.class); + assertThat(e.getCause().getCause()).isInstanceOf(RuntimeException.class); + assertThat(e.getMessage()).contains("Async Producer Mock exception"); + } handler.setSendTimeout(1); - assertThatExceptionOfType(MessageTimeoutException.class) - .isThrownBy(() -> handler.handleMessage(new GenericMessage<>("foo"))) - .withMessageContaining("Timeout waiting for response from KafkaProducer") - .withCauseExactlyInstanceOf(TimeoutException.class); + try { + handler.handleMessage(new GenericMessage<>("foo")); + fail("MessageTimeoutException expected"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(MessageTimeoutException.class); + assertThat(e.getCause()).isExactlyInstanceOf(TimeoutException.class); + assertThat(e.getMessage()).contains("Timeout waiting for response from KafkaProducer"); + } } }