Skip to content

Commit

Permalink
Merge branch '2.2.x' into 2.3.x
Browse files Browse the repository at this point in the history
Closes gh-22669
  • Loading branch information
wilkinsona committed Jul 30, 2020
2 parents 7e547b6 + 22dc4e7 commit 45346b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7206,7 +7206,7 @@ It can also be used to configure the host, scheme, and port that appears in any

[[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-docs-mock-mvc]]
===== Auto-configured Spring REST Docs Tests with Mock MVC
`@AutoConfigureRestDocs` customizes the `MockMvc` bean to use Spring REST Docs.
`@AutoConfigureRestDocs` customizes the `MockMvc` bean to use Spring REST Docs when testing Servlet-based web applications.
You can inject it by using `@Autowired` and use it in your tests as you normally would when using Mock MVC and Spring REST Docs, as shown in the following example:

[source,java,indent=0]
Expand Down Expand Up @@ -7276,7 +7276,7 @@ The following example shows a `RestDocumentationResultHandler` being defined:

[[boot-features-testing-spring-boot-applications-testing-autoconfigured-rest-docs-web-test-client]]
===== Auto-configured Spring REST Docs Tests with WebTestClient
`@AutoConfigureRestDocs` can also be used with `WebTestClient`.
`@AutoConfigureRestDocs` can also be used with `WebTestClient` when testing reactive web applications.
You can inject it by using `@Autowired` and use it in your tests as you normally would when using `@WebFluxTest` and Spring REST Docs, as shown in the following example:

[source,java,indent=0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,16 +23,25 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import io.restassured.RestAssured;

import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.test.web.servlet.MockMvc;

/**
* Annotation that can be applied to a test class to enable and configure
* auto-configuration of Spring REST Docs. Allows configuration of the output directory
* and the host, scheme, and port of generated URIs. When further configuration is
* required a {@link RestDocsMockMvcConfigurationCustomizer} bean can be used.
* auto-configuration of Spring REST Docs. The auto-configuration sets up
* {@link MockMvc}-based testing of a servlet web application, {@link WebTestClient}-based
* testing of a reactive web application, or {@link RestAssured}-based testing of any web
* application over HTTP.
* <p>
* Allows configuration of the output directory and the host, scheme, and port of
* generated URIs. When further configuration is required a
* {@link RestDocsMockMvcConfigurationCustomizer} bean can be used.
*
* @author Andy Wilkinson
* @since 1.4.0
Expand Down

0 comments on commit 45346b6

Please sign in to comment.