Class RestTestClientRestDocumentation
java.lang.Object
org.springframework.restdocs.resttestclient.RestTestClientRestDocumentation
Static factory methods for documenting RESTful APIs using Spring Framework's
RestTestClient.- Since:
- 4.1.0
- Author:
- Andy Wilkinson
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ExchangeResult>
Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.static <T extends ExchangeResult>
Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.static <T extends ExchangeResult>
Consumer<T> document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.static <T extends ExchangeResult>
Consumer<T> Returns aConsumerthat, when called, documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aClientHttpRequestInterceptorthat can be used to configure aRestTestClientinstance using the givencontextProvider.
-
Method Details
-
documentationConfiguration
public static RestTestClientRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider) Provides access to aClientHttpRequestInterceptorthat can be used to configure aRestTestClientinstance using the givencontextProvider.- Parameters:
contextProvider- the context provider- Returns:
- the configurer
- See Also:
-
document
public static <T extends ExchangeResult> Consumer<T> document(String identifier, Snippet... snippets) Returns aConsumerthat, when called, documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedsnippets- the snippets- Returns:
- the
Consumerthat will document the API call represented by theExchangeResult. - See Also:
-
document
public static <T extends ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessoris applied to the request before it is documented.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedrequestPreprocessor- the request preprocessorsnippets- the snippets- Returns:
- the
Consumerthat will document the API call represented by theExchangeResult.
-
document
public static <T extends ExchangeResult> Consumer<T> document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets. The givenresponsePreprocessoris applied to the request before it is documented.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedresponsePreprocessor- the response preprocessorsnippets- the snippets- Returns:
- the
Consumerthat will document the API call represented by theExchangeResult.
-
document
public static <T extends ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) Documents the API call with the givenidentifierusing the givensnippetsin addition to any default snippets. The givenrequestPreprocessorandresponsePreprocessorare applied to the request and response respectively before they are documented.- Type Parameters:
T- the type ofExchangeResultthat will be consumed- Parameters:
identifier- an identifier for the API call that is being documentedrequestPreprocessor- the request preprocessorresponsePreprocessor- the response preprocessorsnippets- the snippets- Returns:
- the
Consumerthat will document the API call represented by theExchangeResult.
-