use of com.hotels.styx.api.HttpResponseStatus.BAD_GATEWAY in project styx by ExpediaGroup.
the class InstrumentedPluginTest method errorsMetricIsNotRecordedWhenResponseIsMappedToNon5005xxStatus.
@Test
public void errorsMetricIsNotRecordedWhenResponseIsMappedToNon5005xxStatus() {
Chain chain = request -> aResponse(OK);
String pluginName = "replaceStatusCodeY";
InstrumentedPlugin plugin = instrumentedPlugin("replaceStatusCodeY", (request, aChain) -> aChain.proceed(request).map(response -> responseWithNewStatusCode(response, BAD_GATEWAY)));
LiveHttpResponse response = Mono.from(plugin.intercept(someRequest, chain)).block();
assertThat(response.status(), is(BAD_GATEWAY));
assertThat(getStatusCount(pluginName, "502"), is(1.0));
assertThat(getErrorCount(pluginName), is(0.0));
}
Aggregations