18
18
19
19
import static org .assertj .core .api .Assertions .assertThat ;
20
20
21
- import java .util . List ;
21
+ import java .time . Duration ;
22
22
23
- import org .junit .Test ;
24
- import org .reactivestreams .Subscriber ;
23
+ import org .junit .jupiter .api .Test ;
25
24
26
25
import org .springframework .core .io .buffer .DataBuffer ;
27
26
import org .springframework .core .io .buffer .DataBufferFactory ;
33
32
import org .springframework .integration .channel .QueueChannel ;
34
33
import org .springframework .integration .http .HttpHeaders ;
35
34
import org .springframework .integration .support .MessageBuilder ;
36
- import org .springframework .integration .test .util .TestUtils ;
37
35
import org .springframework .integration .webflux .support .ClientHttpResponseBodyExtractor ;
38
36
import org .springframework .messaging .Message ;
39
37
import org .springframework .messaging .MessageHandlingException ;
52
50
*
53
51
* @since 5.0
54
52
*/
55
- public class WebFluxRequestExecutingMessageHandlerTests {
53
+ class WebFluxRequestExecutingMessageHandlerTests {
56
54
57
55
@ Test
58
- public void testReactiveReturn () {
56
+ void testReactiveReturn () {
59
57
ClientHttpConnector httpConnector =
60
58
new HttpHandlerConnector ((request , response ) -> {
61
59
response .setStatusCode (HttpStatus .OK );
@@ -78,14 +76,13 @@ public void testReactiveReturn() {
78
76
StepVerifier .create (ackChannel , 2 )
79
77
.assertNext (m -> assertThat (m .getHeaders ()).containsEntry (HttpHeaders .STATUS_CODE , HttpStatus .OK ))
80
78
.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 ));
85
82
}
86
83
87
84
@ Test
88
- public void testReactiveErrorOneWay () {
85
+ void testReactiveErrorOneWay () {
89
86
ClientHttpConnector httpConnector =
90
87
new HttpHandlerConnector ((request , response ) -> {
91
88
response .setStatusCode (HttpStatus .UNAUTHORIZED );
@@ -115,7 +112,7 @@ public void testReactiveErrorOneWay() {
115
112
}
116
113
117
114
@ Test
118
- public void testReactiveConnectErrorOneWay () {
115
+ void testReactiveConnectErrorOneWay () {
119
116
ClientHttpConnector httpConnector =
120
117
new HttpHandlerConnector ((request , response ) -> {
121
118
throw new RuntimeException ("Intentional connection error" );
@@ -144,7 +141,7 @@ public void testReactiveConnectErrorOneWay() {
144
141
}
145
142
146
143
@ Test
147
- public void testServiceUnavailableWithoutBody () {
144
+ void testServiceUnavailableWithoutBody () {
148
145
ClientHttpConnector httpConnector =
149
146
new HttpHandlerConnector ((request , response ) -> {
150
147
response .setStatusCode (HttpStatus .SERVICE_UNAVAILABLE );
@@ -185,7 +182,7 @@ public void testServiceUnavailableWithoutBody() {
185
182
186
183
@ Test
187
184
@ SuppressWarnings ("unchecked" )
188
- public void testFluxReply () {
185
+ void testFluxReply () {
189
186
ClientHttpConnector httpConnector = new HttpHandlerConnector ((request , response ) -> {
190
187
response .setStatusCode (HttpStatus .OK );
191
188
response .getHeaders ().setContentType (MediaType .TEXT_PLAIN );
@@ -227,7 +224,7 @@ public void testFluxReply() {
227
224
}
228
225
229
226
@ Test
230
- public void testClientHttpResponseAsReply () {
227
+ void testClientHttpResponseAsReply () {
231
228
ClientHttpConnector httpConnector = new HttpHandlerConnector ((request , response ) -> {
232
229
response .setStatusCode (HttpStatus .OK );
233
230
response .getHeaders ().setContentType (MediaType .TEXT_PLAIN );
@@ -276,5 +273,4 @@ public void testClientHttpResponseAsReply() {
276
273
.verifyComplete ();
277
274
}
278
275
279
-
280
276
}
0 commit comments