|
|
|
@ -36,6 +36,7 @@ import static org.mockito.Mockito.mock;
|
|
|
|
|
* Tests for {@link WebFluxTags}.
|
|
|
|
|
*
|
|
|
|
|
* @author Brian Clozel
|
|
|
|
|
* @author Michael McFadyen
|
|
|
|
|
*/
|
|
|
|
|
public class WebFluxTagsTests {
|
|
|
|
|
|
|
|
|
@ -88,4 +89,38 @@ public class WebFluxTagsTests {
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("CUSTOM");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void outcomeTagIsUnknownWhenResponseIsNull() {
|
|
|
|
|
Tag tag = WebFluxTags.outcome(null);
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void outcomeTagIsUnknownWhenResponseStatusIsNull() {
|
|
|
|
|
this.exchange.getResponse().setStatusCode(null);
|
|
|
|
|
Tag tag = WebFluxTags.outcome(this.exchange);
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void outcomeTagIsSuccessWhenResponseIs2XX() {
|
|
|
|
|
this.exchange.getResponse().setStatusCode(HttpStatus.OK);
|
|
|
|
|
Tag tag = WebFluxTags.outcome(this.exchange);
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("SUCCESS");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void outcomeTagIsClientErrorWhenResponseIs4XX() {
|
|
|
|
|
this.exchange.getResponse().setStatusCode(HttpStatus.BAD_REQUEST);
|
|
|
|
|
Tag tag = WebFluxTags.outcome(this.exchange);
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("CLIENT_ERROR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void outcomeTagIsServerErrorWhenResponseIs5XX() {
|
|
|
|
|
this.exchange.getResponse().setStatusCode(HttpStatus.BAD_GATEWAY);
|
|
|
|
|
Tag tag = WebFluxTags.outcome(this.exchange);
|
|
|
|
|
assertThat(tag.getValue()).isEqualTo("SERVER_ERROR");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|