Skip to content

Commit 4cf5892

Browse files
committed
Remove deprecated code
Closes gh-781
1 parent d0bb8ef commit 4cf5892

File tree

6 files changed

+9
-97
lines changed

6 files changed

+9
-97
lines changed

spring-restdocs-core/src/main/java/org/springframework/restdocs/operation/OperationResponseFactory.java

-16
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.restdocs.operation;
1818

1919
import org.springframework.http.HttpHeaders;
20-
import org.springframework.http.HttpStatus;
2120

2221
/**
2322
* A factory for creating {@link OperationResponse OperationResponses}.
@@ -26,21 +25,6 @@
2625
*/
2726
public class OperationResponseFactory {
2827

29-
/**
30-
* Creates a new {@link OperationResponse}. If the response has any content, the given
31-
* {@code headers} will be augmented to ensure that they include a
32-
* {@code Content-Length} header.
33-
* @param status the status of the response
34-
* @param headers the response's headers
35-
* @param content the content of the response
36-
* @return the {@code OperationResponse}
37-
* @deprecated since 2.0.4 in favor of {@link #create(int, HttpHeaders, byte[])}
38-
*/
39-
@Deprecated
40-
public OperationResponse create(HttpStatus status, HttpHeaders headers, byte[] content) {
41-
return this.create(status.value(), headers, content);
42-
}
43-
4428
/**
4529
* Creates a new {@link OperationResponse}. If the response has any content, the given
4630
* {@code headers} will be augmented to ensure that they include a

spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/FieldTypeResolver.java

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.restdocs.payload;
1818

19-
import java.util.Collections;
2019
import java.util.List;
2120

2221
import org.springframework.http.MediaType;
@@ -30,20 +29,6 @@
3029
*/
3130
public interface FieldTypeResolver {
3231

33-
/**
34-
* Create a {@code FieldTypeResolver} for the given {@code content} and
35-
* {@code contentType}.
36-
* @param content the payload that the {@code FieldTypeResolver} should handle
37-
* @param contentType the content type of the payload
38-
* @return the {@code FieldTypeResolver}
39-
* @deprecated since 2.0.4 in favor of
40-
* {@link #forContentWithDescriptors(byte[], MediaType, List)}
41-
*/
42-
@Deprecated
43-
static FieldTypeResolver forContent(byte[] content, MediaType contentType) {
44-
return forContentWithDescriptors(content, contentType, Collections.emptyList());
45-
}
46-
4732
/**
4833
* Create a {@code FieldTypeResolver} for the given {@code content} and
4934
* {@code contentType}, described by the given {@code descriptors}.

spring-restdocs-core/src/main/java/org/springframework/restdocs/request/AbstractParametersSnippet.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -126,18 +126,6 @@ private void verifyParameterDescriptors(Operation operation) {
126126
*/
127127
protected abstract void verificationFailed(Set<String> undocumentedParameters, Set<String> missingParameters);
128128

129-
/**
130-
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
131-
* be used to generate the documentation key by their
132-
* {@link ParameterDescriptor#getName()}.
133-
* @return the map of path descriptors
134-
* @deprecated since 1.1.0 in favor of {@link #getParameterDescriptors()}
135-
*/
136-
@Deprecated
137-
protected final Map<String, ParameterDescriptor> getFieldDescriptors() {
138-
return this.descriptorsByName;
139-
}
140-
141129
/**
142130
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
143131
* be used to generate the documentation key by their

spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/FieldTypeResolverTests.java

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,27 +36,6 @@ public class FieldTypeResolverTests {
3636
@Rule
3737
public ExpectedException thrownException = ExpectedException.none();
3838

39-
@Test
40-
@Deprecated
41-
public void whenForContentCalledWithJsonContentThenReturnsJsonFieldTypeResolver() {
42-
assertThat(FieldTypeResolver.forContent("{\"field\": \"value\"}".getBytes(), MediaType.APPLICATION_JSON))
43-
.isInstanceOf(JsonContentHandler.class);
44-
}
45-
46-
@Test
47-
@Deprecated
48-
public void whenForContentCalledWithXmlContentThenReturnsXmlContentHandler() {
49-
assertThat(FieldTypeResolver.forContent("<a><b>5</b></a>".getBytes(), MediaType.APPLICATION_XML))
50-
.isInstanceOf(XmlContentHandler.class);
51-
}
52-
53-
@Test
54-
@Deprecated
55-
public void whenForContentIsCalledWithInvalidContentThenExceptionIsThrown() {
56-
this.thrownException.expect(PayloadHandlingException.class);
57-
FieldTypeResolver.forContent("some".getBytes(), MediaType.APPLICATION_XML);
58-
}
59-
6039
@Test
6140
public void whenForContentWithDescriptorsCalledWithJsonContentThenReturnsJsonFieldTypeResolver() {
6241
assertThat(FieldTypeResolver.forContentWithDescriptors("{\"field\": \"value\"}".getBytes(),

spring-restdocs-mockmvc/src/main/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuilders.java

-24
Original file line numberDiff line numberDiff line change
@@ -215,30 +215,6 @@ public static MockHttpServletRequestBuilder request(HttpMethod httpMethod, URI u
215215
return MockMvcRequestBuilders.request(httpMethod, uri);
216216
}
217217

218-
/**
219-
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
220-
* The url template will be captured and made available for documentation.
221-
* @param urlTemplate a URL template; the resulting URL will be encoded
222-
* @param urlVariables zero or more URL variables
223-
* @return the builder for the file upload request
224-
* @deprecated since 2.0.6 in favor of {@link #multipart(String, Object...)}
225-
*/
226-
@Deprecated
227-
public static MockMultipartHttpServletRequestBuilder fileUpload(String urlTemplate, Object... urlVariables) {
228-
return multipart(urlTemplate, urlVariables);
229-
}
230-
231-
/**
232-
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
233-
* @param uri the URL
234-
* @return the builder for the file upload request
235-
* @deprecated since 2.0.6 in favor of {@link #multipart(URI)}
236-
*/
237-
@Deprecated
238-
public static MockMultipartHttpServletRequestBuilder fileUpload(URI uri) {
239-
return multipart(uri);
240-
}
241-
242218
/**
243219
* Create a {@link MockMultipartHttpServletRequestBuilder} for a multipart request.
244220
* The URL template will be captured and made available for documentation.

spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/RestDocumentationRequestBuildersTests.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@
3030

3131
import static org.assertj.core.api.Assertions.assertThat;
3232
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
33-
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.fileUpload;
3433
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
3534
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.head;
35+
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.multipart;
3636
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.options;
3737
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.patch;
3838
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
@@ -130,13 +130,13 @@ public void requestUri() {
130130
}
131131

132132
@Test
133-
public void fileUploadTemplate() {
134-
assertTemplate(fileUpload("/{template}", "t"), HttpMethod.POST);
133+
public void multipartTemplate() {
134+
assertTemplate(multipart("/{template}", "t"), HttpMethod.POST);
135135
}
136136

137137
@Test
138-
public void fileUploadUri() {
139-
assertUri(fileUpload(URI.create("/uri")), HttpMethod.POST);
138+
public void multipartUri() {
139+
assertUri(multipart(URI.create("/uri")), HttpMethod.POST);
140140
}
141141

142142
private void assertTemplate(MockHttpServletRequestBuilder builder, HttpMethod httpMethod) {

0 commit comments

Comments
 (0)