From a0f710037cdde8350c0eaea97b2694534bc411ef Mon Sep 17 00:00:00 2001 From: abilan Date: Tue, 24 Jan 2023 13:48:34 -0500 Subject: [PATCH] Fix TcpClientServerDemoTest.testTimeoutThrow The `IntegrationUtils.wrapInHandlingExceptionIfNecessary()` wraps now any exception if there is no `failedMessage` set --- .../tcpclientserver/TcpClientServerDemoTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/intermediate/tcp-client-server-multiplex/src/test/java/org/springframework/integration/samples/tcpclientserver/TcpClientServerDemoTest.java b/intermediate/tcp-client-server-multiplex/src/test/java/org/springframework/integration/samples/tcpclientserver/TcpClientServerDemoTest.java index b3d0f52f..9213e6c2 100644 --- a/intermediate/tcp-client-server-multiplex/src/test/java/org/springframework/integration/samples/tcpclientserver/TcpClientServerDemoTest.java +++ b/intermediate/tcp-client-server-multiplex/src/test/java/org/springframework/integration/samples/tcpclientserver/TcpClientServerDemoTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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,12 @@ package org.springframework.integration.samples.tcpclientserver; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; - import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; - import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -41,12 +36,15 @@ import org.springframework.messaging.MessagingException; 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; + /** * Demonstrates the use of a gateway as an entry point into the integration flow, * with two pairs of collaborating channel adapters (client and server), which * enables multiplexing multiple messages over the same connection. - * + *

* Requires correlation data in the payload. * * @author Gary Russell @@ -111,12 +109,11 @@ public class TcpClientServerDemoTest { assertThat(results).hasSize(0); } - @Disabled("AssertionError: Expecting code to raise a throwable.") // TODO @Test public void testTimeoutThrow() { assertThatExceptionOfType(MessagingException.class) .isThrownBy(() -> gw.send("TIMEOUT_TEST_THROW")) - .withMessageContaining("No response received for TIMEOUT_TEST"); + .withStackTraceContaining("No response received for TIMEOUT_TEST"); } @Test