diff --git a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java index 9fe4a75edde..17a98ebed23 100644 --- a/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/reactive/server/WebTestClient.java @@ -601,7 +601,7 @@ public interface WebTestClient { * Set the list of acceptable {@linkplain MediaType media types}, as * specified by the {@code Accept} header. * @param acceptableMediaTypes the acceptable media types - * @return the same instance + * @return this spec for further declaration of the request */ S accept(MediaType... acceptableMediaTypes); @@ -609,7 +609,7 @@ public interface WebTestClient { * Set the list of acceptable {@linkplain Charset charsets}, as specified * by the {@code Accept-Charset} header. * @param acceptableCharsets the acceptable charsets - * @return the same instance + * @return this spec for further declaration of the request */ S acceptCharset(Charset... acceptableCharsets); @@ -617,7 +617,7 @@ public interface WebTestClient { * Add a cookie with the given name and value. * @param name the cookie name * @param value the cookie value - * @return the same instance + * @return this spec for further declaration of the request */ S cookie(String name, String value); @@ -628,7 +628,7 @@ public interface WebTestClient { * {@linkplain MultiValueMap#remove(Object) remove} values, or use any of the other * {@link MultiValueMap} methods. * @param cookiesConsumer a function that consumes the cookies map - * @return this builder + * @return this spec for further declaration of the request */ S cookies(Consumer> cookiesConsumer); @@ -637,14 +637,14 @@ public interface WebTestClient { *

The date should be specified as the number of milliseconds since * January 1, 1970 GMT. * @param ifModifiedSince the new value of the header - * @return the same instance + * @return this spec for further declaration of the request */ S ifModifiedSince(ZonedDateTime ifModifiedSince); /** * Set the values of the {@code If-None-Match} header. * @param ifNoneMatches the new value of the header - * @return the same instance + * @return this spec for further declaration of the request */ S ifNoneMatch(String... ifNoneMatches); @@ -652,7 +652,7 @@ public interface WebTestClient { * Add the given, single header value under the given name. * @param headerName the header name * @param headerValues the header value(s) - * @return the same instance + * @return this spec for further declaration of the request */ S header(String headerName, String... headerValues); @@ -663,7 +663,7 @@ public interface WebTestClient { * {@linkplain HttpHeaders#remove(String) remove} values, or use any of the other * {@link HttpHeaders} methods. * @param headersConsumer a function that consumes the {@code HttpHeaders} - * @return this builder + * @return this spec for further declaration of the request */ S headers(Consumer headersConsumer); @@ -674,6 +674,7 @@ public interface WebTestClient { * @param version the API version of the request; this can be a String or * some Object that can be formatted by the inserter — for example, * through an {@link ApiVersionFormatter} + * @return this spec for further declaration of the request * @since 7.0 */ S apiVersion(Object version); @@ -682,7 +683,7 @@ public interface WebTestClient { * Set the attribute with the given name to the given value. * @param name the name of the attribute to add * @param value the value of the attribute to add - * @return this builder + * @return this spec for further declaration of the request */ S attribute(String name, Object value); @@ -691,20 +692,20 @@ public interface WebTestClient { * the consumer are "live", so that the consumer can be used to inspect attributes, * remove attributes, or use any of the other map-provided methods. * @param attributesConsumer a function that consumes the attributes - * @return this builder + * @return this spec for further declaration of the request */ S attributes(Consumer> attributesConsumer); /** * Perform the exchange without a request body. - * @return spec for decoding the response + * @return a spec for decoding the response */ ResponseSpec exchange(); } /** - * Specification for providing body of a request. + * Specification for providing the body of a request. */ interface RequestBodySpec extends RequestHeadersSpec { @@ -712,7 +713,7 @@ public interface WebTestClient { * Set the length of the body in bytes, as specified by the * {@code Content-Length} header. * @param contentLength the content length - * @return the same instance + * @return this spec for further declaration of the request * @see HttpHeaders#setContentLength(long) */ RequestBodySpec contentLength(long contentLength); @@ -721,7 +722,7 @@ public interface WebTestClient { * Set the {@linkplain MediaType media type} of the body, as specified * by the {@code Content-Type} header. * @param contentType the content type - * @return the same instance + * @return this spec for further declaration of the request * @see HttpHeaders#setContentType(MediaType) */ RequestBodySpec contentType(MediaType contentType); @@ -731,7 +732,7 @@ public interface WebTestClient { * {@link WebClient.RequestBodySpec#bodyValue(Object) * bodyValue} method on the underlying {@code WebClient}. * @param body the value to write to the request body - * @return spec for further declaration of the request + * @return this spec for further declaration of the request * @since 5.2 */ RequestHeadersSpec bodyValue(Object body); @@ -744,7 +745,7 @@ public interface WebTestClient { * @param elementClass the class of elements contained in the publisher * @param the type of the elements contained in the publisher * @param the type of the {@code Publisher} - * @return spec for further declaration of the request + * @return this spec for further declaration of the request */ > RequestHeadersSpec body(S publisher, Class elementClass); @@ -755,7 +756,7 @@ public interface WebTestClient { * @param elementTypeRef the type reference of elements contained in the publisher * @param the type of the elements contained in the publisher * @param the type of the {@code Publisher} - * @return spec for further declaration of the request + * @return this spec for further declaration of the request * @since 5.2 */ > RequestHeadersSpec body( @@ -769,7 +770,7 @@ public interface WebTestClient { * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} * @param elementClass the class of elements contained in the producer - * @return spec for further declaration of the request + * @return this spec for further declaration of the request * @since 5.2 */ RequestHeadersSpec body(Object producer, Class elementClass); @@ -782,18 +783,18 @@ public interface WebTestClient { * {@link Publisher} or another producer adaptable to a * {@code Publisher} via {@link ReactiveAdapterRegistry} * @param elementTypeRef the type reference of elements contained in the producer - * @return spec for further declaration of the request + * @return this spec for further declaration of the request * @since 5.2 */ RequestHeadersSpec body(Object producer, ParameterizedTypeReference elementTypeRef); /** * Set the body of the request to the given {@code BodyInserter}. - * This method invokes the + *

This method invokes the * {@link WebClient.RequestBodySpec#body(BodyInserter) * body(BodyInserter)} method on the underlying {@code WebClient}. * @param inserter the body inserter to use - * @return spec for further declaration of the request + * @return this spec for further declaration of the request * @see org.springframework.web.reactive.function.BodyInserters */ RequestHeadersSpec body(BodyInserter inserter); diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/client/RestTestClient.java b/spring-test/src/main/java/org/springframework/test/web/servlet/client/RestTestClient.java index f7f7bd69c6c..7b7385b4ae6 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/client/RestTestClient.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/client/RestTestClient.java @@ -55,10 +55,11 @@ import org.springframework.web.util.UriBuilderFactory; /** * Client for testing web servers that uses {@link RestClient} internally to * perform requests while also providing a fluent API to verify responses. - * This client can connect to any server over HTTP or to a {@link MockMvc} server - * with a mock request and response. * - *

Use one of the bindToXxx methods to create an instance. For example: + *

This client can connect to any server over HTTP or to a {@link MockMvc} + * server with a mock request and response. + * + *

Use one of the {@code bindToXxx()} methods to create an instance. For example: *