Polish WebHttpHandlerBuilder

This commit is contained in:
Rossen Stoyanchev
2017-03-10 10:00:56 -05:00
parent b799013567
commit 2cd6240dab
7 changed files with 129 additions and 136 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.web.reactive;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@@ -158,8 +159,8 @@ public class DispatcherHandlerErrorTests {
this.request = MockServerHttpRequest.get("/unknown-argument-type").build();
ServerWebExchange exchange = createExchange();
WebExceptionHandler exceptionHandler = new ServerError500ExceptionHandler();
WebHandler webHandler = new ExceptionHandlingWebHandler(this.dispatcherHandler, exceptionHandler);
List<WebExceptionHandler> handlers = Collections.singletonList(new ServerError500ExceptionHandler());
WebHandler webHandler = new ExceptionHandlingWebHandler(this.dispatcherHandler, handlers);
webHandler.handle(exchange).block(Duration.ofSeconds(5));
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, exchange.getResponse().getStatusCode());

View File

@@ -18,6 +18,7 @@ package org.springframework.web.reactive.result;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -62,7 +63,7 @@ public class SimpleUrlHandlerMappingIntegrationTests extends AbstractHttpHandler
wac.refresh();
return WebHttpHandlerBuilder.webHandler(new DispatcherHandler(wac))
.exceptionHandlers(new ResponseStatusExceptionHandler())
.exceptionHandlers(Collections.singletonList(new ResponseStatusExceptionHandler()))
.build();
}