org.springframework.test.web.reactive.server.MockServerConfigurer Java Examples

The following examples show how to use org.springframework.test.web.reactive.server.MockServerConfigurer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdviceTraitTesting.java    From problem-spring-web with MIT License 5 votes vote down vote up
default WebTestClient webTestClient() {
    return WebTestClient.bindToController(new ExampleRestController())
            .apply(new MockServerConfigurer() {
                @Override
                public void beforeServerCreated(WebHttpHandlerBuilder builder) {
                    builder.exceptionHandlers(handlers ->
                            handlers.add(0, new ProblemExceptionHandler(mapper(), unit())));
                }
            })
            .controllerAdvice(unit())
            .httpMessageCodecs(this::configureJson)
            .configureClient()
            .exchangeStrategies(ExchangeStrategies.builder().codecs(this::configureJson).build())
            .build();
}