attributes) {
- String generatedSnippetPath = getDefaultOutputDirectory() + File.separator + fileToInclude;
-
- // since 'pass' context does not convert the content, we have to do this manually
- String convertedContent = Asciidoctor.Factory.create().convertFile(
- new File(generatedSnippetPath),
- OptionsBuilder.options().toFile(false).inPlace(false).get());
-
- return createBlock(parent, "pass", convertedContent, attributes, getConfig());
- }
-
- private static String getDefaultOutputDirectory() {
- String executingDirectory = Paths.get(".").toFile().getAbsolutePath();
-
- if (Files.exists(Paths.get(MAVEN_POM))) {
- return executingDirectory + File.separator + MAVEN_TARGET_PATH;
- }
- return executingDirectory + File.separator + GRADLE_BUILD_PATH;
- }
-}
diff --git a/spring-restdocs-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry b/spring-restdocs-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry
deleted file mode 100644
index 084eaa64..00000000
--- a/spring-restdocs-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry
+++ /dev/null
@@ -1 +0,0 @@
-org.springframework.restdocs.asciidoctor.extensions.RestDocsExtensionRegistry
\ No newline at end of file
diff --git a/spring-restdocs-asciidoctor-extensions/src/test/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsSnippetBlockMacroTest.java b/spring-restdocs-asciidoctor-extensions/src/test/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsSnippetBlockMacroTest.java
deleted file mode 100644
index 9876af57..00000000
--- a/spring-restdocs-asciidoctor-extensions/src/test/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsSnippetBlockMacroTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2014-2016 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.restdocs.asciidoctor.extensions;
-
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-
-import org.asciidoctor.Asciidoctor;
-import org.asciidoctor.Options;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-/**
- * Tests for {@link RestDocsSnippetBlockMacro}.
- *
- * @author Gerrit Meier
- */
-public class RestDocsSnippetBlockMacroTest {
-
- @Before
- public void prepareIncludeFiles() throws Exception {
- Files.createDirectories(Paths.get("build/generated-snippets/"));
- Files.copy(Paths.get("src/test/resources/rest_docs_macro.adoc"),
- Paths.get("build/generated-snippets/rest_docs_macro.adoc"), StandardCopyOption.REPLACE_EXISTING);
- }
-
- @Test
- public void replaceRestDocsSnippetBlockWithFile() {
- Asciidoctor asciidoctor = Asciidoctor.Factory.create();
- asciidoctor.javaExtensionRegistry().blockMacro("snippet", RestDocsSnippetBlockMacro.class);
-
- assertThat(asciidoctor.convert("snippet::rest_docs_macro.adoc[]", new Options()),
- equalTo(""));
- }
-
-}
diff --git a/spring-restdocs-asciidoctor-extensions/src/test/resources/rest_docs_macro.adoc b/spring-restdocs-asciidoctor-extensions/src/test/resources/rest_docs_macro.adoc
deleted file mode 100644
index 276e7895..00000000
--- a/spring-restdocs-asciidoctor-extensions/src/test/resources/rest_docs_macro.adoc
+++ /dev/null
@@ -1 +0,0 @@
-test text
\ No newline at end of file
diff --git a/spring-restdocs-asciidoctor/build.gradle b/spring-restdocs-asciidoctor/build.gradle
new file mode 100644
index 00000000..6897242e
--- /dev/null
+++ b/spring-restdocs-asciidoctor/build.gradle
@@ -0,0 +1,7 @@
+description = 'Asciidoctor extensions for Spring REST Docs'
+
+dependencies {
+ compileOnly 'org.asciidoctor:asciidoctorj'
+ testCompile 'junit:junit'
+ testCompile 'org.asciidoctor:asciidoctorj'
+}
diff --git a/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessor.java b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessor.java
new file mode 100644
index 00000000..7caa35f9
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014-2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.restdocs.asciidoctor;
+
+import java.io.File;
+
+import org.asciidoctor.ast.Document;
+import org.asciidoctor.extension.Preprocessor;
+import org.asciidoctor.extension.PreprocessorReader;
+
+/**
+ * {@link Preprocessor} that sets defaults for REST Docs-related {@link Document}
+ * attributes.
+ *
+ * @author Andy Wilkinson
+ */
+final class DefaultAttributesPreprocessor extends Preprocessor {
+
+ private final SnippetsDirectoryResolver snippetsDirectoryResolver = new SnippetsDirectoryResolver(
+ new File("."));
+
+ @Override
+ public PreprocessorReader process(Document document, PreprocessorReader reader) {
+ document.setAttr("snippets", this.snippetsDirectoryResolver
+ .getSnippetsDirectory(document.getAttributes()), false);
+ return reader;
+ }
+
+}
diff --git a/spring-restdocs-asciidoctor-extensions/src/main/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsExtensionRegistry.java b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/RestDocsExtensionRegistry.java
similarity index 53%
rename from spring-restdocs-asciidoctor-extensions/src/main/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsExtensionRegistry.java
rename to spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/RestDocsExtensionRegistry.java
index 82a8e60b..15bca154 100644
--- a/spring-restdocs-asciidoctor-extensions/src/main/java/org/springframework/restdocs/asciidoctor/extensions/RestDocsExtensionRegistry.java
+++ b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/RestDocsExtensionRegistry.java
@@ -14,32 +14,22 @@
* limitations under the License.
*/
-package org.springframework.restdocs.asciidoctor.extensions;
+package org.springframework.restdocs.asciidoctor;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.extension.spi.ExtensionRegistry;
/**
- * ExtensionRegistry for the Spring Rest Docs macros to get registered
- * in all projects that include this asciidoctor extension module.
- *
- * Macros provided:
- *
- * - {@link RestDocsSnippetBlockMacro}
- *
+ * Asciidoctor {@link ExtensionRegistry} for Spring REST Docs.
*
- * @author Gerrit Meier
+ * @author Andy Wilkinson
*/
-public class RestDocsExtensionRegistry implements ExtensionRegistry {
-
- /**
- * the name that identifies the block macro in the asciidoctor document
- * (e.g. snippet::file_to_include[]
)
- */
- private static final String SNIPPET_BLOCK_NAME = "snippet";
+public final class RestDocsExtensionRegistry implements ExtensionRegistry {
@Override
public void register(Asciidoctor asciidoctor) {
- asciidoctor.javaExtensionRegistry().blockMacro(SNIPPET_BLOCK_NAME, RestDocsSnippetBlockMacro.class);
+ asciidoctor.javaExtensionRegistry()
+ .preprocessor(new DefaultAttributesPreprocessor());
}
+
}
diff --git a/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolver.java b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolver.java
new file mode 100644
index 00000000..dd6829ad
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/main/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolver.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014-2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.restdocs.asciidoctor;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+
+/**
+ * Resolves the directory from which snippets can be read for inclusion in an Asciidoctor
+ * document. The resolved directory is relative to the {@code docdir} of the Asciidoctor
+ * document that it being rendered.
+ *
+ * @author Andy Wilkinson
+ */
+class SnippetsDirectoryResolver {
+
+ private final File root;
+
+ SnippetsDirectoryResolver(File root) {
+ this.root = root;
+ }
+
+ File getSnippetsDirectory(Map attributes) {
+ if (new File(this.root, "pom.xml").exists()) {
+ return getMavenSnippetsDirectory(attributes);
+ }
+ return getGradleSnippetsDirectory(attributes);
+ }
+
+ private File getMavenSnippetsDirectory(Map attributes) {
+ Path rootPath = Paths.get(this.root.getAbsolutePath());
+ Path docDirPath = Paths.get((String) attributes.get("docdir"));
+ Path relativePath = docDirPath.relativize(rootPath);
+ return new File(relativePath.toFile(), "target/generated-snippets");
+ }
+
+ private File getGradleSnippetsDirectory(Map attributes) {
+ return new File((String) attributes.get("projectdir"),
+ "build/generated-snippets");
+ }
+
+}
diff --git a/spring-restdocs-asciidoctor/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry b/spring-restdocs-asciidoctor/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry
new file mode 100644
index 00000000..7c790a30
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/main/resources/META-INF/services/org.asciidoctor.extension.spi.ExtensionRegistry
@@ -0,0 +1 @@
+org.springframework.restdocs.asciidoctor.RestDocsExtensionRegistry
\ No newline at end of file
diff --git a/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessorTests.java b/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessorTests.java
new file mode 100644
index 00000000..699bb49a
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/DefaultAttributesPreprocessorTests.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014-2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.restdocs.asciidoctor;
+
+import org.asciidoctor.Asciidoctor;
+import org.asciidoctor.Attributes;
+import org.asciidoctor.Options;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for {@link DefaultAttributesPreprocessor}.
+ *
+ * @author Andy Wilkinson
+ */
+public class DefaultAttributesPreprocessorTests {
+
+ @Test
+ public void snippetsAttributeIsSet() {
+ String converted = Asciidoctor.Factory.create().convert("{snippets}",
+ new Options());
+ assertThat(converted, containsString("build/generated-snippets"));
+ }
+
+ @Test
+ public void snippetsAttributeFromConvertArgumentIsNotOverridden() {
+ Options options = new Options();
+ options.setAttributes(new Attributes("snippets=custom"));
+ String converted = Asciidoctor.Factory.create().convert("{snippets}", options);
+ assertThat(converted, containsString("custom"));
+ }
+
+ @Test
+ public void snippetsAttributeFromDocumentPreambleIsNotOverridden() {
+ Options options = new Options();
+ options.setAttributes(new Attributes("snippets=custom"));
+ String converted = Asciidoctor.Factory.create()
+ .convert(":snippets: custom\n{snippets}", options);
+ assertThat(converted, containsString("custom"));
+ }
+
+}
diff --git a/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolverTests.java b/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolverTests.java
new file mode 100644
index 00000000..f998caf4
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/test/java/org/springframework/restdocs/asciidoctor/SnippetsDirectoryResolverTests.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2014-2016 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.restdocs.asciidoctor;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for {@link SnippetsDirectoryResolver}.
+ *
+ * @author Andy Wilkinson
+ */
+public class SnippetsDirectoryResolverTests {
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Test
+ public void mavenProjectsUseTargetGeneratedSnippetsRelativeToDocDir()
+ throws IOException {
+ this.temporaryFolder.newFile("pom.xml");
+ Map attributes = new HashMap<>();
+ attributes.put("docdir",
+ new File(this.temporaryFolder.getRoot(), "src/main/asciidoc")
+ .getAbsolutePath());
+ File snippetsDirectory = new SnippetsDirectoryResolver(
+ this.temporaryFolder.getRoot()).getSnippetsDirectory(attributes);
+ assertThat(snippetsDirectory.isAbsolute(), is(false));
+ assertThat(snippetsDirectory,
+ equalTo(new File("../../../target/generated-snippets")));
+ }
+
+ @Test
+ public void gradleProjectsUseBuildGeneratedSnippetsBeneathProjectDir()
+ throws IOException {
+ Map attributes = new HashMap<>();
+ attributes.put("projectdir", "project/dir");
+ File snippetsDirectory = new SnippetsDirectoryResolver(
+ this.temporaryFolder.getRoot()).getSnippetsDirectory(attributes);
+ assertThat(snippetsDirectory,
+ equalTo(new File("project/dir/build/generated-snippets")));
+ }
+
+}
diff --git a/spring-restdocs-asciidoctor/src/test/resources/sample-snippet.adoc b/spring-restdocs-asciidoctor/src/test/resources/sample-snippet.adoc
new file mode 100644
index 00000000..0a3d1fa7
--- /dev/null
+++ b/spring-restdocs-asciidoctor/src/test/resources/sample-snippet.adoc
@@ -0,0 +1,4 @@
+[source,bash]
+----
+$ curl 'http://localhost:8080/' -i -H 'Accept: application/hal+json'
+----
\ No newline at end of file
diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/ManualRestDocumentation.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/ManualRestDocumentation.java
index 19a8188c..472832ff 100644
--- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/ManualRestDocumentation.java
+++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/ManualRestDocumentation.java
@@ -17,8 +17,6 @@
package org.springframework.restdocs;
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Paths;
/**
* {@code ManualRestDocumentation} is used to manually manage the
@@ -33,11 +31,6 @@ import java.nio.file.Paths;
*/
public final class ManualRestDocumentation implements RestDocumentationContextProvider {
- private static final String GENERATED_SNIPPETS_PATH = "generated-snippets";
- private static final String MAVEN_TARGET_PATH = "target" + File.separator + GENERATED_SNIPPETS_PATH;
- private static final String GRADLE_BUILD_PATH = "build" + File.separator + GENERATED_SNIPPETS_PATH;
- private static final String MAVEN_POM = "pom.xml";
-
private final File outputDirectory;
private RestDocumentationContext context;
@@ -57,7 +50,11 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
* @param outputDirectory the output directory
*/
public ManualRestDocumentation(String outputDirectory) {
- this.outputDirectory = new File(outputDirectory);
+ this(new File(outputDirectory));
+ }
+
+ private ManualRestDocumentation(File outputDirectory) {
+ this.outputDirectory = outputDirectory;
}
/**
@@ -94,12 +91,11 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
return this.context;
}
- private static String getDefaultOutputDirectory() {
- String executingDirectory = Paths.get(".").toFile().getAbsolutePath();
-
- if (Files.exists(Paths.get(MAVEN_POM))) {
- return executingDirectory + File.separator + MAVEN_TARGET_PATH;
+ private static File getDefaultOutputDirectory() {
+ if (new File("pom.xml").exists()) {
+ return new File("target/generated-snippets");
}
- return executingDirectory + File.separator + GRADLE_BUILD_PATH;
+ return new File("build/generated-snippets");
}
+
}
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/config/RestDocumentationConfigurerTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/config/RestDocumentationConfigurerTests.java
index 0692cf61..995a6ffb 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/config/RestDocumentationConfigurerTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/config/RestDocumentationConfigurerTests.java
@@ -195,7 +195,8 @@ public class RestDocumentationConfigurerTests {
}
private RestDocumentationContext createContext() {
- ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation("build");
+ ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(
+ "build");
manualRestDocumentation.beforeTest(null, null);
RestDocumentationContext context = manualRestDocumentation.beforeOperation();
return context;
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/RestDocumentationContextPlaceholderResolverTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/RestDocumentationContextPlaceholderResolverTests.java
index 7fa1d1c4..83f96e61 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/RestDocumentationContextPlaceholderResolverTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/RestDocumentationContextPlaceholderResolverTests.java
@@ -83,7 +83,8 @@ public class RestDocumentationContextPlaceholderResolverTests {
}
private RestDocumentationContext createContext(String methodName) {
- ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation("build");
+ ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(
+ "build");
manualRestDocumentation.beforeTest(getClass(), methodName);
RestDocumentationContext context = manualRestDocumentation.beforeOperation();
return context;
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/StandardWriterResolverTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/StandardWriterResolverTests.java
index 49bdd4cc..a4d3460d 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/StandardWriterResolverTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/StandardWriterResolverTests.java
@@ -70,7 +70,8 @@ public class StandardWriterResolverTests {
}
private RestDocumentationContext createContext(String outputDir) {
- ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(outputDir);
+ ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(
+ outputDir);
manualRestDocumentation.beforeTest(getClass(), null);
RestDocumentationContext context = manualRestDocumentation.beforeOperation();
return context;
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/OperationBuilder.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/OperationBuilder.java
index 154c59e2..698a80da 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/OperationBuilder.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/OperationBuilder.java
@@ -123,7 +123,8 @@ public class OperationBuilder extends OperationTestRule {
}
private RestDocumentationContext createContext() {
- ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(this.outputDirectory.getAbsolutePath());
+ ManualRestDocumentation manualRestDocumentation = new ManualRestDocumentation(
+ this.outputDirectory.getAbsolutePath());
manualRestDocumentation.beforeTest(null, null);
RestDocumentationContext context = manualRestDocumentation.beforeOperation();
return context;