Fix TcpClientServerDemoTest.testTimeoutThrow

The `IntegrationUtils.wrapInHandlingExceptionIfNecessary()`
wraps now any exception if there is no `failedMessage` set
This commit is contained in:
abilan
2023-01-24 13:48:34 -05:00
parent cf92516330
commit a0f710037c

View File

@@ -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.
*
* <p>
* 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