diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java index 58dca679ff..ff0d21c833 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/InboundGatewayTests.java @@ -56,8 +56,8 @@ import org.springframework.messaging.MessagingException; import org.springframework.messaging.support.ErrorMessage; import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; +import org.springframework.retry.RetryListener; import org.springframework.retry.backoff.NoBackOffPolicy; -import org.springframework.retry.listener.RetryListenerSupport; import org.springframework.retry.policy.SimpleRetryPolicy; import org.springframework.retry.support.RetryTemplate; @@ -379,14 +379,10 @@ class InboundGatewayTests { KafkaTemplate template = new KafkaTemplate<>(pf); template.setDefaultTopic(topic7); KafkaInboundGateway gateway = new KafkaInboundGateway<>(container, template); - MessageChannel out = new DirectChannel() { - - @Override - protected boolean doSend(Message message, long timeout) { - throw new RuntimeException("intended"); - } - - }; + MessageChannel out = + (message, timeout) -> { + throw new RuntimeException("intended"); + }; gateway.setRequestChannel(out); gateway.setBeanFactory(mock(BeanFactory.class)); gateway.setReplyTimeout(30_000); @@ -396,11 +392,12 @@ class InboundGatewayTests { retryTemplate.setRetryPolicy(retryPolicy); retryTemplate.setBackOffPolicy(new NoBackOffPolicy()); final CountDownLatch retryCountLatch = new CountDownLatch(retryPolicy.getMaxAttempts()); - retryTemplate.registerListener(new RetryListenerSupport() { + retryTemplate.registerListener(new RetryListener() { @Override public void onError(RetryContext context, RetryCallback callback, Throwable throwable) { + retryCountLatch.countDown(); } }); diff --git a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java index 443b2aea18..818da37a39 100644 --- a/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java +++ b/spring-integration-kafka/src/test/java/org/springframework/integration/kafka/inbound/MessageDrivenAdapterTests.java @@ -83,7 +83,7 @@ import org.springframework.messaging.PollableChannel; import org.springframework.messaging.support.ErrorMessage; import org.springframework.retry.RetryCallback; import org.springframework.retry.RetryContext; -import org.springframework.retry.listener.RetryListenerSupport; +import org.springframework.retry.RetryListener; import org.springframework.retry.policy.SimpleRetryPolicy; import org.springframework.retry.support.RetryTemplate; @@ -310,11 +310,12 @@ class MessageDrivenAdapterTests { retryPolicy.setMaxAttempts(2); retryTemplate.setRetryPolicy(retryPolicy); final CountDownLatch retryCountLatch = new CountDownLatch(retryPolicy.getMaxAttempts()); - retryTemplate.registerListener(new RetryListenerSupport() { + retryTemplate.registerListener(new RetryListener() { @Override public void onError(RetryContext context, RetryCallback callback, Throwable throwable) { + retryCountLatch.countDown(); } });