Package org.springframework.restdocs
Class JUnitRestDocumentation
java.lang.Object
org.springframework.restdocs.JUnitRestDocumentation
- All Implemented Interfaces:
org.junit.rules.TestRule
,RestDocumentationContextProvider
public class JUnitRestDocumentation
extends Object
implements RestDocumentationContextProvider, org.junit.rules.TestRule
A JUnit
TestRule
used to automatically manage the
RestDocumentationContext
.- Since:
- 1.1.0
- Author:
- Andy Wilkinson
-
Constructor Summary
ConstructorDescriptionCreates a newJUnitRestDocumentation
instance that will generate snippets to <gradle/maven build path>/generated-snippet.JUnitRestDocumentation
(String outputDirectory) Creates a newJUnitRestDocumentation
instance that will generate snippets to the givenoutputDirectory
. -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) Returns aRestDocumentationContext
for the operation that is about to be performed.
-
Constructor Details
-
JUnitRestDocumentation
public JUnitRestDocumentation()Creates a newJUnitRestDocumentation
instance that will generate snippets to <gradle/maven build path>/generated-snippet. -
JUnitRestDocumentation
Creates a newJUnitRestDocumentation
instance that will generate snippets to the givenoutputDirectory
.- Parameters:
outputDirectory
- the output directory
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-
beforeOperation
Description copied from interface:RestDocumentationContextProvider
Returns aRestDocumentationContext
for the operation that is about to be performed.- Specified by:
beforeOperation
in interfaceRestDocumentationContextProvider
- Returns:
- the context for the operation
-