Commit 53e7484d authored by Ali Dehghani's avatar Ali Dehghani Committed by Stephane Nicoll

Add error rendering support with @WebFluxTest

See gh-16266
parent 62d9c0a8
...@@ -100,7 +100,8 @@ org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,\ ...@@ -100,7 +100,8 @@ org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration,\
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\ org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\
org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\ org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration,\
org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration
# AutoConfigureMockMvc auto-configuration imports # AutoConfigureMockMvc auto-configuration imports
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc=\ org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc=\
......
...@@ -18,6 +18,8 @@ package org.springframework.boot.test.autoconfigure.web.reactive.webclient; ...@@ -18,6 +18,8 @@ package org.springframework.boot.test.autoconfigure.web.reactive.webclient;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
...@@ -27,8 +29,10 @@ import org.springframework.web.server.WebExceptionHandler; ...@@ -27,8 +29,10 @@ import org.springframework.web.server.WebExceptionHandler;
* Example {@link WebExceptionHandler} used with {@link WebFluxTest} tests. * Example {@link WebExceptionHandler} used with {@link WebFluxTest} tests.
* *
* @author Madhura Bhave * @author Madhura Bhave
* @author Ali Dehghani
*/ */
@Component @Component
@Order(Ordered.HIGHEST_PRECEDENCE)
public class ExampleWebExceptionHandler implements WebExceptionHandler { public class ExampleWebExceptionHandler implements WebExceptionHandler {
@Override @Override
......
...@@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfigura ...@@ -25,6 +25,7 @@ import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfigura
import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration;
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration; import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
...@@ -37,6 +38,7 @@ import static org.springframework.boot.test.autoconfigure.AutoConfigurationImpor ...@@ -37,6 +38,7 @@ import static org.springframework.boot.test.autoconfigure.AutoConfigurationImpor
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @author Artsiom Yudovin * @author Artsiom Yudovin
* @author Ali Dehghani
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@WebFluxTest @WebFluxTest
...@@ -75,4 +77,10 @@ public class WebFluxTestAutoConfigurationIntegrationTests { ...@@ -75,4 +77,10 @@ public class WebFluxTestAutoConfigurationIntegrationTests {
.has(importedAutoConfiguration(ThymeleafAutoConfiguration.class)); .has(importedAutoConfiguration(ThymeleafAutoConfiguration.class));
} }
@Test
public void errorWebFluxAutoConfigurationIsImported() {
assertThat(this.applicationContext)
.has(importedAutoConfiguration(ErrorWebFluxAutoConfiguration.class));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment