Add shortcut to mutate + apply to WebTestClient
Issue: SPR-15770
This commit is contained in:
@@ -141,6 +141,11 @@ class DefaultWebTestClient implements WebTestClient {
|
||||
return this.builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebTestClient mutateWith(WebTestClientConfigurer configurer) {
|
||||
return mutate().apply(configurer).build();
|
||||
}
|
||||
|
||||
|
||||
private class DefaultRequestBodyUriSpec implements RequestBodyUriSpec {
|
||||
|
||||
|
||||
@@ -135,12 +135,23 @@ public interface WebTestClient {
|
||||
RequestBodyUriSpec method(HttpMethod method);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a builder to mutate properties of this web test client.
|
||||
*/
|
||||
Builder mutate();
|
||||
|
||||
/**
|
||||
* Mutate the {@link WebTestClient}, apply the given configurer, and build
|
||||
* a new instance. Essentially a shortcut for:
|
||||
* <pre>
|
||||
* mutate().apply(configurer).build();
|
||||
* </pre>
|
||||
* @param configurer the configurer to apply
|
||||
* @return the mutated test client
|
||||
*/
|
||||
WebTestClient mutateWith(WebTestClientConfigurer configurer);
|
||||
|
||||
|
||||
// Static, factory methods
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user