File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
spring-boot-project/spring-boot-docs/src
main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringrestdocs/withwebtestclient Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -748,6 +748,14 @@ If you require more control over Spring REST Docs configuration than offered by
748
748
include::{docs-java}/features/testing/springbootapplications/autoconfiguredspringrestdocs/withwebtestclient/MyRestDocsConfiguration.java[]
749
749
----
750
750
751
+ If you want to make use of Spring REST Docs support for a parameterized output directory, you can use a `WebTestClientBuilderCustomizer` to configure a consumer for every entity exchange result.
752
+ The following example shows such a `WebTestClientBuilderCustomizer` being defined:
753
+
754
+ [source,java,indent=0]
755
+ ----
756
+ include::{docs-java}/features/testing/springbootapplications/autoconfiguredspringrestdocs/withwebtestclient/MyWebTestClientBuilderCustomizerConfiguration.java[]
757
+ ----
758
+
751
759
752
760
753
761
[[features.testing.spring-boot-applications.autoconfigured-spring-restdocs.with-rest-assured]]
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012-2021 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .springframework .boot .docs .test .autoconfigure .restdocs .webclient ;
18
+
19
+ import org .springframework .boot .test .context .TestConfiguration ;
20
+ import org .springframework .boot .test .web .reactive .server .WebTestClientBuilderCustomizer ;
21
+ import org .springframework .context .annotation .Bean ;
22
+
23
+ import static org .springframework .restdocs .webtestclient .WebTestClientRestDocumentation .document ;
24
+
25
+ @ TestConfiguration (proxyBeanMethods = false )
26
+ public class MyWebTestClientBuilderCustomizerConfiguration {
27
+
28
+ @ Bean
29
+ public WebTestClientBuilderCustomizer restDocumentation () {
30
+ return (builder ) -> builder .entityExchangeResultConsumer (document ("{method-name}" ));
31
+ }
32
+
33
+ }
You can’t perform that action at this time.
0 commit comments