Remove deprecated code

Closes gh-781
This commit is contained in:
Andy Wilkinson
2022-01-17 13:24:58 +00:00
parent d0bb8ef59d
commit 4cf5892015
6 changed files with 9 additions and 97 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.restdocs.operation;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
/**
* A factory for creating {@link OperationResponse OperationResponses}.
@@ -26,21 +25,6 @@ import org.springframework.http.HttpStatus;
*/
public class OperationResponseFactory {
/**
* Creates a new {@link OperationResponse}. If the response has any content, the given
* {@code headers} will be augmented to ensure that they include a
* {@code Content-Length} header.
* @param status the status of the response
* @param headers the response's headers
* @param content the content of the response
* @return the {@code OperationResponse}
* @deprecated since 2.0.4 in favor of {@link #create(int, HttpHeaders, byte[])}
*/
@Deprecated
public OperationResponse create(HttpStatus status, HttpHeaders headers, byte[] content) {
return this.create(status.value(), headers, content);
}
/**
* Creates a new {@link OperationResponse}. If the response has any content, the given
* {@code headers} will be augmented to ensure that they include a

View File

@@ -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.
@@ -16,7 +16,6 @@
package org.springframework.restdocs.payload;
import java.util.Collections;
import java.util.List;
import org.springframework.http.MediaType;
@@ -30,20 +29,6 @@ import org.springframework.http.MediaType;
*/
public interface FieldTypeResolver {
/**
* Create a {@code FieldTypeResolver} for the given {@code content} and
* {@code contentType}.
* @param content the payload that the {@code FieldTypeResolver} should handle
* @param contentType the content type of the payload
* @return the {@code FieldTypeResolver}
* @deprecated since 2.0.4 in favor of
* {@link #forContentWithDescriptors(byte[], MediaType, List)}
*/
@Deprecated
static FieldTypeResolver forContent(byte[] content, MediaType contentType) {
return forContentWithDescriptors(content, contentType, Collections.emptyList());
}
/**
* Create a {@code FieldTypeResolver} for the given {@code content} and
* {@code contentType}, described by the given {@code descriptors}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2020 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.
@@ -126,18 +126,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
*/
protected abstract void verificationFailed(Set<String> undocumentedParameters, Set<String> missingParameters);
/**
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
* be used to generate the documentation key by their
* {@link ParameterDescriptor#getName()}.
* @return the map of path descriptors
* @deprecated since 1.1.0 in favor of {@link #getParameterDescriptors()}
*/
@Deprecated
protected final Map<String, ParameterDescriptor> getFieldDescriptors() {
return this.descriptorsByName;
}
/**
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
* be used to generate the documentation key by their

View File

@@ -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.
@@ -36,27 +36,6 @@ public class FieldTypeResolverTests {
@Rule
public ExpectedException thrownException = ExpectedException.none();
@Test
@Deprecated
public void whenForContentCalledWithJsonContentThenReturnsJsonFieldTypeResolver() {
assertThat(FieldTypeResolver.forContent("{\"field\": \"value\"}".getBytes(), MediaType.APPLICATION_JSON))
.isInstanceOf(JsonContentHandler.class);
}
@Test
@Deprecated
public void whenForContentCalledWithXmlContentThenReturnsXmlContentHandler() {
assertThat(FieldTypeResolver.forContent("<a><b>5</b></a>".getBytes(), MediaType.APPLICATION_XML))
.isInstanceOf(XmlContentHandler.class);
}
@Test
@Deprecated
public void whenForContentIsCalledWithInvalidContentThenExceptionIsThrown() {
this.thrownException.expect(PayloadHandlingException.class);
FieldTypeResolver.forContent("some".getBytes(), MediaType.APPLICATION_XML);
}
@Test
public void whenForContentWithDescriptorsCalledWithJsonContentThenReturnsJsonFieldTypeResolver() {
assertThat(FieldTypeResolver.forContentWithDescriptors("{\"field\": \"value\"}".getBytes(),