Skip to content

Commit 86bee7f

Browse files
committed
* Fix WebFluxRequestExecutingMessageHandlerTests
1 parent 5ceb151 commit 86bee7f

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@
1818

1919
import static org.assertj.core.api.Assertions.assertThat;
2020

21-
import java.util.List;
21+
import java.time.Duration;
2222

23-
import org.junit.Test;
24-
import org.reactivestreams.Subscriber;
23+
import org.junit.jupiter.api.Test;
2524

2625
import org.springframework.core.io.buffer.DataBuffer;
2726
import org.springframework.core.io.buffer.DataBufferFactory;
@@ -33,7 +32,6 @@
3332
import org.springframework.integration.channel.QueueChannel;
3433
import org.springframework.integration.http.HttpHeaders;
3534
import org.springframework.integration.support.MessageBuilder;
36-
import org.springframework.integration.test.util.TestUtils;
3735
import org.springframework.integration.webflux.support.ClientHttpResponseBodyExtractor;
3836
import org.springframework.messaging.Message;
3937
import org.springframework.messaging.MessageHandlingException;
@@ -52,10 +50,10 @@
5250
*
5351
* @since 5.0
5452
*/
55-
public class WebFluxRequestExecutingMessageHandlerTests {
53+
class WebFluxRequestExecutingMessageHandlerTests {
5654

5755
@Test
58-
public void testReactiveReturn() {
56+
void testReactiveReturn() {
5957
ClientHttpConnector httpConnector =
6058
new HttpHandlerConnector((request, response) -> {
6159
response.setStatusCode(HttpStatus.OK);
@@ -78,14 +76,13 @@ public void testReactiveReturn() {
7876
StepVerifier.create(ackChannel, 2)
7977
.assertNext(m -> assertThat(m.getHeaders()).containsEntry(HttpHeaders.STATUS_CODE, HttpStatus.OK))
8078
.assertNext(m -> assertThat(m.getHeaders()).containsEntry(HttpHeaders.STATUS_CODE, HttpStatus.OK))
81-
.then(() ->
82-
((Subscriber<?>) TestUtils.getPropertyValue(ackChannel, "subscribers", List.class).get(0))
83-
.onComplete())
84-
.verifyComplete();
79+
.expectNoEvent(Duration.ofMillis(100))
80+
.thenCancel()
81+
.verify(Duration.ofSeconds(1));
8582
}
8683

8784
@Test
88-
public void testReactiveErrorOneWay() {
85+
void testReactiveErrorOneWay() {
8986
ClientHttpConnector httpConnector =
9087
new HttpHandlerConnector((request, response) -> {
9188
response.setStatusCode(HttpStatus.UNAUTHORIZED);
@@ -115,7 +112,7 @@ public void testReactiveErrorOneWay() {
115112
}
116113

117114
@Test
118-
public void testReactiveConnectErrorOneWay() {
115+
void testReactiveConnectErrorOneWay() {
119116
ClientHttpConnector httpConnector =
120117
new HttpHandlerConnector((request, response) -> {
121118
throw new RuntimeException("Intentional connection error");
@@ -144,7 +141,7 @@ public void testReactiveConnectErrorOneWay() {
144141
}
145142

146143
@Test
147-
public void testServiceUnavailableWithoutBody() {
144+
void testServiceUnavailableWithoutBody() {
148145
ClientHttpConnector httpConnector =
149146
new HttpHandlerConnector((request, response) -> {
150147
response.setStatusCode(HttpStatus.SERVICE_UNAVAILABLE);
@@ -185,7 +182,7 @@ public void testServiceUnavailableWithoutBody() {
185182

186183
@Test
187184
@SuppressWarnings("unchecked")
188-
public void testFluxReply() {
185+
void testFluxReply() {
189186
ClientHttpConnector httpConnector = new HttpHandlerConnector((request, response) -> {
190187
response.setStatusCode(HttpStatus.OK);
191188
response.getHeaders().setContentType(MediaType.TEXT_PLAIN);
@@ -227,7 +224,7 @@ public void testFluxReply() {
227224
}
228225

229226
@Test
230-
public void testClientHttpResponseAsReply() {
227+
void testClientHttpResponseAsReply() {
231228
ClientHttpConnector httpConnector = new HttpHandlerConnector((request, response) -> {
232229
response.setStatusCode(HttpStatus.OK);
233230
response.getHeaders().setContentType(MediaType.TEXT_PLAIN);
@@ -276,5 +273,4 @@ public void testClientHttpResponseAsReply() {
276273
.verifyComplete();
277274
}
278275

279-
280276
}

0 commit comments

Comments
 (0)