Class WebTestClientRestDocumentation

java.lang.Object
org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation

public abstract class WebTestClientRestDocumentation extends Object
Static factory methods for documenting RESTful APIs using WebFlux's WebTestClient.
Since:
2.0.0
Author:
Andy Wilkinson
  • Method Details

    • documentationConfiguration

      public static WebTestClientRestDocumentationConfigurer documentationConfiguration(RestDocumentationContextProvider contextProvider)
      Provides access to a ExchangeFilterFunction that can be used to configure a WebTestClient instance using the given contextProvider.
      Parameters:
      contextProvider - the context provider
      Returns:
      the configurer
      See Also:
      • WebTestClient.Builder.filter(ExchangeFilterFunction)
    • document

      public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, Snippet... snippets)
      Returns a Consumer that, when called, documents the API call with the given identifier using the given snippets in addition to any default snippets.
      Type Parameters:
      T - the type of ExchangeResult that will be consumed
      Parameters:
      identifier - an identifier for the API call that is being documented
      snippets - the snippets
      Returns:
      the Consumer that will document the API call represented by the ExchangeResult.
      See Also:
      • WebTestClient.BodySpec.consumeWith(Consumer)
      • WebTestClient.BodyContentSpec.consumeWith(Consumer)
    • document

      public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, Snippet... snippets)
      Documents the API call with the given identifier using the given snippets in addition to any default snippets. The given requestPreprocessor is applied to the request before it is documented.
      Type Parameters:
      T - the type of ExchangeResult that will be consumed
      Parameters:
      identifier - an identifier for the API call that is being documented
      requestPreprocessor - the request preprocessor
      snippets - the snippets
      Returns:
      the Consumer that will document the API call represented by the ExchangeResult.
    • document

      public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets)
      Documents the API call with the given identifier using the given snippets in addition to any default snippets. The given responsePreprocessor is applied to the request before it is documented.
      Type Parameters:
      T - the type of ExchangeResult that will be consumed
      Parameters:
      identifier - an identifier for the API call that is being documented
      responsePreprocessor - the response preprocessor
      snippets - the snippets
      Returns:
      the Consumer that will document the API call represented by the ExchangeResult.
    • document

      public static <T extends org.springframework.test.web.reactive.server.ExchangeResult> Consumer<T> document(String identifier, OperationRequestPreprocessor requestPreprocessor, OperationResponsePreprocessor responsePreprocessor, Snippet... snippets)
      Documents the API call with the given identifier using the given snippets in addition to any default snippets. The given requestPreprocessor and responsePreprocessor are applied to the request and response respectively before they are documented.
      Type Parameters:
      T - the type of ExchangeResult that will be consumed
      Parameters:
      identifier - an identifier for the API call that is being documented
      requestPreprocessor - the request preprocessor
      responsePreprocessor - the response preprocessor
      snippets - the snippets
      Returns:
      the Consumer that will document the API call represented by the ExchangeResult.