|
21 | 21 | import org.junit.jupiter.api.Test;
|
22 | 22 |
|
23 | 23 | import org.springframework.http.HttpStatus;
|
| 24 | +import org.springframework.http.server.reactive.AbstractServerHttpResponse; |
24 | 25 | import org.springframework.http.server.reactive.ServerHttpRequest;
|
25 | 26 | import org.springframework.mock.http.server.reactive.MockServerHttpRequest;
|
26 | 27 | import org.springframework.mock.web.server.MockServerWebExchange;
|
|
37 | 38 | *
|
38 | 39 | * @author Brian Clozel
|
39 | 40 | * @author Michael McFadyen
|
| 41 | + * @author Madhura Bhave |
40 | 42 | */
|
41 | 43 | class WebFluxTagsTests {
|
42 | 44 |
|
@@ -114,7 +116,20 @@ void methodTagToleratesNonStandardHttpMethods() {
|
114 | 116 | void outcomeTagIsUnknownWhenResponseStatusIsNull() {
|
115 | 117 | this.exchange.getResponse().setStatusCode(null);
|
116 | 118 | Tag tag = WebFluxTags.outcome(this.exchange);
|
117 |
| - assertThat(tag.getValue()).isEqualTo("UNKNOWN"); |
| 119 | + assertThat(tag.getValue()).isEqualTo("SUCCESS"); |
| 120 | + } |
| 121 | + |
| 122 | + @Test |
| 123 | + void outcomeTagIsSuccessWhenResponseStatusIsAvailableFromUnderlyingServer() { |
| 124 | + ServerWebExchange exchange = mock(ServerWebExchange.class); |
| 125 | + ServerHttpRequest request = mock(ServerHttpRequest.class); |
| 126 | + AbstractServerHttpResponse response = mock(AbstractServerHttpResponse.class); |
| 127 | + given(response.getStatusCode()).willReturn(HttpStatus.OK); |
| 128 | + given(response.getStatusCodeValue()).willReturn(null); |
| 129 | + given(exchange.getRequest()).willReturn(request); |
| 130 | + given(exchange.getResponse()).willReturn(response); |
| 131 | + Tag tag = WebFluxTags.outcome(exchange); |
| 132 | + assertThat(tag.getValue()).isEqualTo("SUCCESS"); |
118 | 133 | }
|
119 | 134 |
|
120 | 135 | @Test
|
|
0 commit comments