This commit is contained in:
Phillip Webb 2019-08-03 14:28:47 +01:00
parent b29e81fcd9
commit 2cdceb92bf
4 changed files with 7 additions and 6 deletions

View File

@ -186,7 +186,7 @@ class WebMvcMetricsFilterTests {
void streamingError() throws Exception {
MvcResult result = this.mvc.perform(get("/api/c1/streamingError")).andExpect(request().asyncStarted())
.andReturn();
assertThatCode(() -> this.mvc.perform(asyncDispatch(result)).andExpect(status().isOk()));
this.mvc.perform(asyncDispatch(result)).andExpect(status().isOk());
assertThat(this.registry.get("http.server.requests").tags("exception", "IOException").timer().count())
.isEqualTo(1L);
}

View File

@ -46,7 +46,6 @@ import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ -84,8 +83,8 @@ class WebMvcMetricsIntegrationTests {
}
@Test
void rethrownExceptionIsRecordedInMetricTag() {
assertThatCode(() -> this.mvc.perform(get("/api/rethrownError")).andExpect(status().is5xxServerError()));
void rethrownExceptionIsRecordedInMetricTag() throws Exception {
this.mvc.perform(get("/api/rethrownError")).andExpect(status().is5xxServerError());
assertThat(this.registry.get("http.server.requests").tags("exception", "Exception2", "status", "500").timer()
.count()).isEqualTo(1L);
}

View File

@ -31,7 +31,7 @@ public class TestJsonConverter extends JsonConverter {
@Override
public JSONArray toJsonArray(ConfigurationMetadata metadata, ItemType itemType) throws Exception {
return toJsonArray(metadata, itemType);
return super.toJsonArray(metadata, itemType);
}
@Override

View File

@ -106,7 +106,9 @@ public class NettyWebServer implements WebServer {
}
private void applyRouteProviders(HttpServerRoutes routes) {
this.routeProviders.forEach((provider) -> provider.apply(routes));
for (NettyRouteProvider provider : this.routeProviders) {
routes = provider.apply(routes);
}
routes.route(ALWAYS, this.handlerAdapter);
}