Interface MockServerConfigurer
public interface MockServerConfigurer
Contract that frameworks or applications can use to pre-package a set of
customizations to a
WebTestClient.MockServerSpec and expose that
as a shortcut.
An implementation of this interface can be plugged in via
WebTestClient.MockServerSpec.apply(MockServerConfigurer) where instances are likely obtained
via static methods, for example:
import static org.example.ExampleSetup.securitySetup;
// ...
WebTestClient.bindToController(new TestController())
.apply(securitySetup("foo","bar"))
.build();
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidafterConfigureAdded(WebTestClient.MockServerSpec<?> serverSpec) Invoked immediately, i.e.default voidbeforeServerCreated(WebHttpHandlerBuilder builder) Invoked just before the mock server is built.
-
Method Details
-
afterConfigureAdded
Invoked immediately, i.e. before this method returns.- Parameters:
serverSpec- the serverSpec to which the configurer is added
-
beforeServerCreated
Invoked just before the mock server is built. Use this hook to inspect and/or modify application-declared filters and exception handlers.- Parameters:
builder- the builder for theHttpHandlerthat will handle requests (i.e. the mock server)
-