Polish WebHttpHandlerBuilder
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user