Merge branch '2.0.x'
This commit is contained in:
@@ -31,7 +31,7 @@ None of these is essential for a pull request, but they will all help
|
||||
|
||||
### Building from source
|
||||
|
||||
To build the source you will need Java 8 or later.
|
||||
To build the source you will need Java 17 or later.
|
||||
The code is built with Gradle:
|
||||
|
||||
```
|
||||
|
||||
@@ -14,7 +14,7 @@ To learn more about Spring REST Docs, please consult the [reference documentatio
|
||||
|
||||
## Building from source
|
||||
|
||||
You will need Java 8 or later to build Spring REST Docs.
|
||||
You will need Java 17 or later to build Spring REST Docs.
|
||||
It is built using [Gradle][10]:
|
||||
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -28,14 +28,14 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
|
||||
|
||||
@ExtendWith(RestDocumentationExtension.class)
|
||||
public class ExampleApplicationJUnit5Tests {
|
||||
class ExampleApplicationJUnit5Tests {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// tag::setup[]
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(WebApplicationContext webApplicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
void setUp(WebApplicationContext webApplicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
|
||||
.apply(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -27,14 +27,14 @@ import org.springframework.restdocs.RestDocumentationExtension;
|
||||
import static org.springframework.restdocs.restassured.RestAssuredRestDocumentation.documentationConfiguration;
|
||||
|
||||
@ExtendWith(RestDocumentationExtension.class)
|
||||
public class ExampleApplicationJUnit5Tests {
|
||||
class ExampleApplicationJUnit5Tests {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// tag::setup[]
|
||||
private RequestSpecification spec;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(RestDocumentationContextProvider restDocumentation) {
|
||||
void setUp(RestDocumentationContextProvider restDocumentation) {
|
||||
this.spec = new RequestSpecBuilder().addFilter(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -27,14 +27,14 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import static org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation.documentationConfiguration;
|
||||
|
||||
@ExtendWith(RestDocumentationExtension.class)
|
||||
public class ExampleApplicationJUnit5Tests {
|
||||
class ExampleApplicationJUnit5Tests {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
// tag::setup[]
|
||||
private WebTestClient webTestClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp(ApplicationContext applicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
void setUp(ApplicationContext applicationContext, RestDocumentationContextProvider restDocumentation) {
|
||||
this.webTestClient = WebTestClient.bindToApplicationContext(applicationContext).configureClient()
|
||||
.filter(documentationConfiguration(restDocumentation)) // <1>
|
||||
.build();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -149,7 +149,7 @@ public final class Preprocessors {
|
||||
|
||||
/**
|
||||
* Returns a {@code HeadersModifyingOperationPreprocessor} that can then be configured
|
||||
* to modify the headers of the request.
|
||||
* to modify the headers of the request or response.
|
||||
* @return the preprocessor
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
@@ -90,10 +90,10 @@ public class HeadersModifyingOperationPreprocessorTests {
|
||||
|
||||
@Test
|
||||
public void removeHeader() {
|
||||
OperationPreprocessor preprocessor = this.preprocessor.remove("a");
|
||||
assertThat(preprocessor.preprocess(createRequest((headers) -> headers.add("a", "apple"))).getHeaders())
|
||||
this.preprocessor.remove("a");
|
||||
assertThat(this.preprocessor.preprocess(createRequest((headers) -> headers.add("a", "apple"))).getHeaders())
|
||||
.doesNotContainKey("a");
|
||||
assertThat(preprocessor.preprocess(createResponse((headers) -> headers.add("a", "apple"))).getHeaders())
|
||||
assertThat(this.preprocessor.preprocess(createResponse((headers) -> headers.add("a", "apple"))).getHeaders())
|
||||
.doesNotContainKey("a");
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ public abstract class RestDocumentationRequestBuilders {
|
||||
/**
|
||||
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
|
||||
* @param uri the URL
|
||||
* @return the builder for the file upload request
|
||||
* @return the builder for the multipart request
|
||||
* @since 2.0.6
|
||||
*/
|
||||
public static MockMultipartHttpServletRequestBuilder multipart(URI uri) {
|
||||
|
||||
Reference in New Issue
Block a user