Break cycle caused by introduction of RestDocumentationHandler

This commit is contained in:
Andy Wilkinson
2016-02-05 21:15:33 +00:00
parent 712d785b95
commit c0fac14fdf
8 changed files with 63 additions and 41 deletions

View File

@@ -17,7 +17,7 @@
package org.springframework.restdocs.mockmvc;
import org.springframework.restdocs.RestDocumentation;
import org.springframework.restdocs.RestDocumentationHandler;
import org.springframework.restdocs.generate.RestDocumentationGenerator;
import org.springframework.restdocs.operation.preprocess.OperationRequestPreprocessor;
import org.springframework.restdocs.operation.preprocess.OperationResponsePreprocessor;
import org.springframework.restdocs.snippet.Snippet;
@@ -66,7 +66,7 @@ public abstract class MockMvcRestDocumentation {
*/
public static RestDocumentationResultHandler document(String identifier,
Snippet... snippets) {
return new RestDocumentationResultHandler(new RestDocumentationHandler<>(
return new RestDocumentationResultHandler(new RestDocumentationGenerator<>(
identifier, REQUEST_CONVERTER, RESPONSE_CONVERTER, snippets));
}
@@ -84,7 +84,7 @@ public abstract class MockMvcRestDocumentation {
*/
public static RestDocumentationResultHandler document(String identifier,
OperationRequestPreprocessor requestPreprocessor, Snippet... snippets) {
return new RestDocumentationResultHandler(new RestDocumentationHandler<>(
return new RestDocumentationResultHandler(new RestDocumentationGenerator<>(
identifier, REQUEST_CONVERTER, RESPONSE_CONVERTER, requestPreprocessor,
snippets));
}
@@ -103,7 +103,7 @@ public abstract class MockMvcRestDocumentation {
*/
public static RestDocumentationResultHandler document(String identifier,
OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) {
return new RestDocumentationResultHandler(new RestDocumentationHandler<>(
return new RestDocumentationResultHandler(new RestDocumentationGenerator<>(
identifier, REQUEST_CONVERTER, RESPONSE_CONVERTER, responsePreprocessor,
snippets));
}
@@ -125,7 +125,7 @@ public abstract class MockMvcRestDocumentation {
public static RestDocumentationResultHandler document(String identifier,
OperationRequestPreprocessor requestPreprocessor,
OperationResponsePreprocessor responsePreprocessor, Snippet... snippets) {
return new RestDocumentationResultHandler(new RestDocumentationHandler<>(
return new RestDocumentationResultHandler(new RestDocumentationGenerator<>(
identifier, REQUEST_CONVERTER, RESPONSE_CONVERTER, requestPreprocessor,
responsePreprocessor, snippets));
}

View File

@@ -20,7 +20,7 @@ import java.util.Map;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.restdocs.RestDocumentationHandler;
import org.springframework.restdocs.generate.RestDocumentationGenerator;
import org.springframework.restdocs.snippet.Snippet;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultHandler;
@@ -35,10 +35,10 @@ import org.springframework.util.Assert;
*/
public class RestDocumentationResultHandler implements ResultHandler {
private final RestDocumentationHandler<MockHttpServletRequest, MockHttpServletResponse> delegate;
private final RestDocumentationGenerator<MockHttpServletRequest, MockHttpServletResponse> delegate;
RestDocumentationResultHandler(
RestDocumentationHandler<MockHttpServletRequest, MockHttpServletResponse> delegate) {
RestDocumentationGenerator<MockHttpServletRequest, MockHttpServletResponse> delegate) {
Assert.notNull(delegate, "delegate must be non-null");
this.delegate = delegate;
}