diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
index 4c188cd4..c54f7a92 100644
--- a/config/checkstyle/checkstyle.xml
+++ b/config/checkstyle/checkstyle.xml
@@ -73,7 +73,7 @@
+ value="com.jayway.restassured.RestAssured.*, org.junit.Assert.*, org.junit.Assume.*, org.hamcrest.CoreMatchers.*, org.hamcrest.Matchers.*, org.mockito.Mockito.*, org.mockito.BDDMockito.*, org.mockito.Matchers.*, org.springframework.restdocs.curl.CurlDocumentation.*, org.springframework.restdocs.headers.HeaderDocumentation.*, org.springframework.restdocs.hypermedia.HypermediaDocumentation.*, org.springframework.restdocs.mockmvc.IterableEnumeration.*, org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.*, org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*, org.springframework.restdocs.payload.PayloadDocumentation.*, org.springframework.restdocs.operation.preprocess.Preprocessors.*, org.springframework.restdocs.request.RequestDocumentation.*, org.springframework.restdocs.restassured.RestAssuredRestDocumentation.*, org.springframework.restdocs.restassured.operation.preprocess.RestAssuredPreprocessors.*, org.springframework.restdocs.snippet.Attributes.*, org.springframework.restdocs.templates.TemplateFormats.*, org.springframework.restdocs.test.SnippetMatchers.*, org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*, org.springframework.test.web.servlet.result.MockMvcResultMatchers.*" />
diff --git a/docs/src/docs/asciidoc/configuration.adoc b/docs/src/docs/asciidoc/configuration.adoc
index f068507e..7941cb9e 100644
--- a/docs/src/docs/asciidoc/configuration.adoc
+++ b/docs/src/docs/asciidoc/configuration.adoc
@@ -59,11 +59,11 @@ include::{examples-dir}/com/example/restassured/CustomEncoding.java[tags=custom-
-[[configuration-snippet-format]]
-=== Snippet format
+[[configuration-snippet-template-format]]
+=== Snippet template format
-The default snippet format is Asciidoctor. Markdown is also supported out of the box. You
-can change the default format using the `RestDocumentationConfigurer` API:
+The default snippet template format is Asciidoctor. Markdown is also supported out of the
+box. You can change the default format using the `RestDocumentationConfigurer` API:
[source,java,indent=0,role="primary"]
.MockMvc
diff --git a/docs/src/test/java/com/example/mockmvc/CustomFormat.java b/docs/src/test/java/com/example/mockmvc/CustomFormat.java
index ab121224..3a32a9b5 100644
--- a/docs/src/test/java/com/example/mockmvc/CustomFormat.java
+++ b/docs/src/test/java/com/example/mockmvc/CustomFormat.java
@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.restdocs.RestDocumentation;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@@ -42,7 +42,7 @@ public class CustomFormat {
// tag::custom-format[]
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation)
- .snippets().withFormat(SnippetFormats.markdown()))
+ .snippets().withTemplateFormat(TemplateFormats.markdown()))
.build();
// end::custom-format[]
}
diff --git a/docs/src/test/java/com/example/restassured/CustomFormat.java b/docs/src/test/java/com/example/restassured/CustomFormat.java
index 649becb2..c5424ec2 100644
--- a/docs/src/test/java/com/example/restassured/CustomFormat.java
+++ b/docs/src/test/java/com/example/restassured/CustomFormat.java
@@ -19,7 +19,7 @@ package com.example.restassured;
import org.junit.Before;
import org.junit.Rule;
import org.springframework.restdocs.RestDocumentation;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.specification.RequestSpecification;
@@ -38,7 +38,7 @@ public class CustomFormat {
// tag::custom-format[]
this.spec = new RequestSpecBuilder()
.addFilter(documentationConfiguration(this.restDocumentation)
- .snippets().withFormat(SnippetFormats.markdown()))
+ .snippets().withTemplateFormat(TemplateFormats.markdown()))
.build();
// end::custom-format[]
}
diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/config/RestDocumentationConfigurer.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/config/RestDocumentationConfigurer.java
index ee721725..f77c7aa4 100644
--- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/config/RestDocumentationConfigurer.java
+++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/config/RestDocumentationConfigurer.java
@@ -104,7 +104,7 @@ public abstract class RestDocumentationConfigurer extends AbstractNestedConfigurer
extends AbstractNestedConfigurer
configuration, RestDocumentationContext context) {
configuration.put(SnippetConfiguration.class.getName(), new SnippetConfiguration(
- this.snippetEncoding, this.snippetFormat));
+ this.snippetEncoding, this.templateFormat));
configuration.put(ATTRIBUTE_DEFAULT_SNIPPETS, this.defaultSnippets);
}
@@ -106,14 +106,14 @@ public abstract class SnippetConfigurer
extends AbstractNestedConfigurer
codeBlock(String language) {
- return SnippetMatchers.codeBlock(this.snippetFormat, language);
+ return SnippetMatchers.codeBlock(this.templateFormat, language);
}
public TableMatcher> tableWithHeader(String... headers) {
- return SnippetMatchers.tableWithHeader(this.snippetFormat, headers);
+ return SnippetMatchers.tableWithHeader(this.templateFormat, headers);
}
public TableMatcher> tableWithTitleAndHeader(String title, String... headers) {
- return SnippetMatchers
- .tableWithTitleAndHeader(this.snippetFormat, title, headers);
+ return SnippetMatchers.tableWithTitleAndHeader(this.templateFormat, title,
+ headers);
}
public HttpRequestMatcher httpRequest(RequestMethod method, String uri) {
- return SnippetMatchers.httpRequest(this.snippetFormat, method, uri);
+ return SnippetMatchers.httpRequest(this.templateFormat, method, uri);
}
public HttpResponseMatcher httpResponse(HttpStatus responseStatus) {
- return SnippetMatchers.httpResponse(this.snippetFormat, responseStatus);
+ return SnippetMatchers.httpResponse(this.templateFormat, responseStatus);
}
public OperationBuilder operationBuilder(String name) {
return new OperationBuilder(name, this.snippet.getOutputDirectory(),
- this.snippetFormat);
+ this.templateFormat);
}
protected FileSystemResource snippetResource(String name) {
return new FileSystemResource("src/test/resources/custom-snippet-templates/"
- + this.snippetFormat.getFileExtension() + "/" + name + ".snippet");
+ + this.templateFormat.getId() + "/" + name + ".snippet");
}
}
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 2dad00fe..9819d8c5 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
@@ -28,10 +28,10 @@ import org.springframework.restdocs.curl.CurlRequestSnippet;
import org.springframework.restdocs.http.HttpRequestSnippet;
import org.springframework.restdocs.http.HttpResponseSnippet;
import org.springframework.restdocs.snippet.Snippet;
-import org.springframework.restdocs.snippet.SnippetFormats;
import org.springframework.restdocs.snippet.StandardWriterResolver;
import org.springframework.restdocs.snippet.WriterResolver;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -83,8 +83,8 @@ public class RestDocumentationConfigurerTests {
SnippetConfiguration snippetConfiguration = (SnippetConfiguration) configuration
.get(SnippetConfiguration.class.getName());
assertThat(snippetConfiguration.getEncoding(), is(equalTo("UTF-8")));
- assertThat(snippetConfiguration.getFormat(),
- is(equalTo(SnippetFormats.asciidoctor())));
+ assertThat(snippetConfiguration.getTemplateFormat(),
+ is(equalTo(TemplateFormats.asciidoctor())));
}
@Test
@@ -139,10 +139,10 @@ public class RestDocumentationConfigurerTests {
}
@Test
- public void customSnippetFormat() {
+ public void customTemplateFormat() {
RestDocumentationContext context = new RestDocumentationContext(null, null, null);
Map configuration = new HashMap<>();
- this.configurer.snippets().withFormat(SnippetFormats.markdown())
+ this.configurer.snippets().withTemplateFormat(TemplateFormats.markdown())
.apply(configuration, context);
assertThat(
configuration,
@@ -150,8 +150,8 @@ public class RestDocumentationConfigurerTests {
instanceOf(SnippetConfiguration.class)));
SnippetConfiguration snippetConfiguration = (SnippetConfiguration) configuration
.get(SnippetConfiguration.class.getName());
- assertThat(snippetConfiguration.getFormat(),
- is(equalTo(SnippetFormats.markdown())));
+ assertThat(snippetConfiguration.getTemplateFormat(),
+ is(equalTo(TemplateFormats.markdown())));
}
private static final class TestRestDocumentationConfigurer
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/curl/CurlRequestSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/curl/CurlRequestSnippetTests.java
index f93b0467..645866c7 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/curl/CurlRequestSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/curl/CurlRequestSnippetTests.java
@@ -24,8 +24,8 @@ import org.junit.runners.Parameterized;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.util.Base64Utils;
@@ -48,8 +48,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
@RunWith(Parameterized.class)
public class CurlRequestSnippetTests extends AbstractSnippetTests {
- public CurlRequestSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public CurlRequestSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetFailureTests.java
index ca011d2b..9a5a2a7e 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetFailureTests.java
@@ -23,7 +23,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -40,7 +40,7 @@ import static org.springframework.restdocs.headers.HeaderDocumentation.headerWit
public class RequestHeadersSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetTests.java
index ed076d26..d9732a90 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/RequestHeadersSnippetTests.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.restdocs.test.OperationBuilder;
@@ -42,8 +42,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class RequestHeadersSnippetTests extends AbstractSnippetTests {
- public RequestHeadersSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public RequestHeadersSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetFailureTests.java
index 382e9125..fae54627 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetFailureTests.java
@@ -23,7 +23,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -40,7 +40,7 @@ import static org.springframework.restdocs.headers.HeaderDocumentation.headerWit
public class ResponseHeadersSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetTests.java
index f58805e0..33a53cb8 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetTests.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.restdocs.test.OperationBuilder;
@@ -42,8 +42,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class ResponseHeadersSnippetTests extends AbstractSnippetTests {
- public ResponseHeadersSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public ResponseHeadersSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpRequestSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpRequestSnippetTests.java
index 41e90bfb..44bd5786 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpRequestSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpRequestSnippetTests.java
@@ -22,8 +22,8 @@ import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -44,8 +44,8 @@ public class HttpRequestSnippetTests extends AbstractSnippetTests {
private static final String BOUNDARY = "6o2knFse3p53ty9dmcQvWAIx1zInP11uCfbm";
- public HttpRequestSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public HttpRequestSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpResponseSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpResponseSnippetTests.java
index 96bc7be4..8d63d175 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpResponseSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/http/HttpResponseSnippetTests.java
@@ -23,8 +23,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -42,8 +42,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class HttpResponseSnippetTests extends AbstractSnippetTests {
- public HttpResponseSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public HttpResponseSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetFailureTests.java
index 335127cf..ce16c635 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetFailureTests.java
@@ -24,7 +24,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -39,7 +39,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
public class LinksSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetTests.java
index c3bd55a7..4c22d8b2 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetTests.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -39,8 +39,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class LinksSnippetTests extends AbstractSnippetTests {
- public LinksSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public LinksSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/AsciidoctorRequestFieldsSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/AsciidoctorRequestFieldsSnippetTests.java
index a56e8ed5..000fabd6 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/AsciidoctorRequestFieldsSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/AsciidoctorRequestFieldsSnippetTests.java
@@ -22,8 +22,8 @@ import java.util.Arrays;
import org.junit.Rule;
import org.junit.Test;
import org.springframework.core.io.FileSystemResource;
-import org.springframework.restdocs.snippet.SnippetFormats;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
import org.springframework.restdocs.test.ExpectedSnippet;
@@ -32,7 +32,7 @@ import org.springframework.restdocs.test.OperationBuilder;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
-import static org.springframework.restdocs.snippet.SnippetFormats.asciidoctor;
+import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
import static org.springframework.restdocs.test.SnippetMatchers.tableWithHeader;
/**
@@ -43,7 +43,7 @@ import static org.springframework.restdocs.test.SnippetMatchers.tableWithHeader;
public class AsciidoctorRequestFieldsSnippetTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Test
public void requestFieldsWithListDescription() throws IOException {
@@ -67,8 +67,9 @@ public class AsciidoctorRequestFieldsSnippetTests {
}
private FileSystemResource snippetResource(String name) {
- return new FileSystemResource("src/test/resources/custom-snippet-templates/adoc/"
- + name + ".snippet");
+ return new FileSystemResource(
+ "src/test/resources/custom-snippet-templates/asciidoctor/" + name
+ + ".snippet");
}
}
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetFailureTests.java
index 442616b6..f4a762ce 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetFailureTests.java
@@ -26,7 +26,7 @@ import org.junit.rules.ExpectedException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -44,7 +44,7 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
public class RequestFieldsSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetTests.java
index 7f9a665a..ff0b5c95 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestFieldsSnippetTests.java
@@ -23,8 +23,8 @@ import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -42,8 +42,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class RequestFieldsSnippetTests extends AbstractSnippetTests {
- public RequestFieldsSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public RequestFieldsSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetFailureTests.java
index d664b807..6591d714 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetFailureTests.java
@@ -26,7 +26,7 @@ import org.junit.rules.ExpectedException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -44,7 +44,7 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
public class ResponseFieldsSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetTests.java
index f4e00111..623d5149 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/ResponseFieldsSnippetTests.java
@@ -23,8 +23,8 @@ import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -42,8 +42,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class ResponseFieldsSnippetTests extends AbstractSnippetTests {
- public ResponseFieldsSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public ResponseFieldsSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetFailureTests.java
index 7f9a07b8..06310faf 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetFailureTests.java
@@ -24,7 +24,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -40,7 +40,7 @@ import static org.springframework.restdocs.request.RequestDocumentation.paramete
public class PathParametersSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java
index 9d148769..7f989a82 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -40,8 +40,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class PathParametersSnippetTests extends AbstractSnippetTests {
- public PathParametersSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public PathParametersSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetFailureTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetFailureTests.java
index b795dd57..849b0d5d 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetFailureTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetFailureTests.java
@@ -24,7 +24,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.restdocs.snippet.SnippetException;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.test.ExpectedSnippet;
import org.springframework.restdocs.test.OperationBuilder;
@@ -40,7 +40,7 @@ import static org.springframework.restdocs.request.RequestDocumentation.paramete
public class RequestParametersSnippetFailureTests {
@Rule
- public ExpectedSnippet snippet = new ExpectedSnippet(SnippetFormats.asciidoctor());
+ public ExpectedSnippet snippet = new ExpectedSnippet(TemplateFormats.asciidoctor());
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetTests.java
index 2facc40c..944db79e 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetTests.java
@@ -21,8 +21,8 @@ import java.util.Arrays;
import org.junit.Test;
import org.springframework.restdocs.AbstractSnippetTests;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.templates.TemplateResourceResolver;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
@@ -40,8 +40,8 @@ import static org.springframework.restdocs.snippet.Attributes.key;
*/
public class RequestParametersSnippetTests extends AbstractSnippetTests {
- public RequestParametersSnippetTests(String name, SnippetFormat snippetFormat) {
- super(name, snippetFormat);
+ public RequestParametersSnippetTests(String name, TemplateFormat templateFormat) {
+ super(name, templateFormat);
}
@Test
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 31bdb75d..3f2406a5 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
@@ -26,7 +26,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
-import static org.springframework.restdocs.snippet.SnippetFormats.asciidoctor;
+import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
/**
* Tests for {@link StandardWriterResolver}.
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/templates/StandardTemplateResourceResolverTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/templates/StandardTemplateResourceResolverTests.java
index 00a3c8d4..8d8ef578 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/templates/StandardTemplateResourceResolverTests.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/templates/StandardTemplateResourceResolverTests.java
@@ -29,7 +29,7 @@ import org.springframework.core.io.Resource;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
-import static org.springframework.restdocs.snippet.SnippetFormats.asciidoctor;
+import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
/**
* Tests for {@link TemplateResourceResolver}.
@@ -68,8 +68,8 @@ public class StandardTemplateResourceResolverTests {
@Test
public void fallsBackToDefaultSnippet() throws Exception {
this.classLoader.addResource(
- "org/springframework/restdocs/templates/adoc/test.snippet", getClass()
- .getResource("test.snippet"));
+ "org/springframework/restdocs/templates/asciidoctor/test.snippet",
+ getClass().getResource("test.snippet"));
Resource snippet = doWithThreadContextClassLoader(this.classLoader,
new Callable() {
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/ExpectedSnippet.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/ExpectedSnippet.java
index 6a571f35..1bc8b49c 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/ExpectedSnippet.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/ExpectedSnippet.java
@@ -23,8 +23,8 @@ import org.hamcrest.Matcher;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
-import org.springframework.restdocs.snippet.SnippetFormat;
import org.springframework.restdocs.snippet.TemplatedSnippet;
+import org.springframework.restdocs.templates.TemplateFormat;
import org.springframework.restdocs.test.SnippetMatchers.SnippetMatcher;
import static org.hamcrest.CoreMatchers.is;
@@ -39,7 +39,7 @@ import static org.junit.Assert.assertThat;
*/
public class ExpectedSnippet implements TestRule {
- private final SnippetFormat snippetFormat;
+ private final TemplateFormat templateFormat;
private final SnippetMatcher snippet;
@@ -49,9 +49,9 @@ public class ExpectedSnippet implements TestRule {
private File outputDirectory;
- public ExpectedSnippet(SnippetFormat snippetFormat) {
- this.snippetFormat = snippetFormat;
- this.snippet = SnippetMatchers.snippet(snippetFormat);
+ public ExpectedSnippet(TemplateFormat templateFormat) {
+ this.templateFormat = templateFormat;
+ this.snippet = SnippetMatchers.snippet(templateFormat);
}
@Override
@@ -65,7 +65,7 @@ public class ExpectedSnippet implements TestRule {
if (this.outputDirectory != null && this.expectedName != null) {
File snippetDir = new File(this.outputDirectory, this.expectedName);
File snippetFile = new File(snippetDir, this.expectedType + "."
- + this.snippetFormat.getFileExtension());
+ + this.templateFormat.getFileExtension());
assertThat(snippetFile, is(this.snippet));
}
}
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 e2a54b99..b9e050d9 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
@@ -37,12 +37,12 @@ import org.springframework.restdocs.operation.OperationResponseFactory;
import org.springframework.restdocs.operation.Parameters;
import org.springframework.restdocs.operation.StandardOperation;
import org.springframework.restdocs.snippet.RestDocumentationContextPlaceholderResolver;
-import org.springframework.restdocs.snippet.SnippetFormat;
-import org.springframework.restdocs.snippet.SnippetFormats;
import org.springframework.restdocs.snippet.StandardWriterResolver;
import org.springframework.restdocs.snippet.WriterResolver;
import org.springframework.restdocs.templates.StandardTemplateResourceResolver;
import org.springframework.restdocs.templates.TemplateEngine;
+import org.springframework.restdocs.templates.TemplateFormat;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.restdocs.templates.mustache.MustacheTemplateEngine;
/**
@@ -60,18 +60,18 @@ public class OperationBuilder {
private final File outputDirectory;
- private final SnippetFormat snippetFormat;
+ private final TemplateFormat templateFormat;
private OperationRequestBuilder requestBuilder;
public OperationBuilder(String name, File outputDirectory) {
- this(name, outputDirectory, SnippetFormats.asciidoctor());
+ this(name, outputDirectory, TemplateFormats.asciidoctor());
}
- public OperationBuilder(String name, File outputDirectory, SnippetFormat snippetFormat) {
+ public OperationBuilder(String name, File outputDirectory, TemplateFormat templateFormat) {
this.name = name;
this.outputDirectory = outputDirectory;
- this.snippetFormat = snippetFormat;
+ this.templateFormat = templateFormat;
}
public OperationRequestBuilder request(String uri) {
@@ -92,14 +92,14 @@ public class OperationBuilder {
if (this.attributes.get(TemplateEngine.class.getName()) == null) {
this.attributes.put(TemplateEngine.class.getName(),
new MustacheTemplateEngine(new StandardTemplateResourceResolver(
- this.snippetFormat)));
+ this.templateFormat)));
}
RestDocumentationContext context = new RestDocumentationContext(null, null,
this.outputDirectory);
this.attributes.put(RestDocumentationContext.class.getName(), context);
this.attributes.put(WriterResolver.class.getName(), new StandardWriterResolver(
new RestDocumentationContextPlaceholderResolver(context), "UTF-8",
- this.snippetFormat));
+ this.templateFormat));
return new StandardOperation(this.name,
(this.requestBuilder == null ? new OperationRequestBuilder(
"http://localhost/").buildRequest() : this.requestBuilder
diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java
index c076d0ca..c08b937b 100644
--- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java
+++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/test/SnippetMatchers.java
@@ -30,8 +30,8 @@ import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.springframework.http.HttpStatus;
-import org.springframework.restdocs.snippet.SnippetFormat;
-import org.springframework.restdocs.snippet.SnippetFormats;
+import org.springframework.restdocs.templates.TemplateFormat;
+import org.springframework.restdocs.templates.TemplateFormats;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -47,18 +47,19 @@ public final class SnippetMatchers {
}
- public static SnippetMatcher snippet(SnippetFormat snippetFormat) {
- return new SnippetMatcher(snippetFormat);
+ public static SnippetMatcher snippet(TemplateFormat templateFormat) {
+ return new SnippetMatcher(templateFormat);
}
- public static TableMatcher> tableWithHeader(SnippetFormat format, String... headers) {
+ public static TableMatcher> tableWithHeader(TemplateFormat format,
+ String... headers) {
if ("adoc".equals(format.getFileExtension())) {
return new AsciidoctorTableMatcher(null, headers);
}
return new MarkdownTableMatcher(null, headers);
}
- public static TableMatcher> tableWithTitleAndHeader(SnippetFormat format,
+ public static TableMatcher> tableWithTitleAndHeader(TemplateFormat format,
String title, String... headers) {
if ("adoc".equals(format.getFileExtension())) {
return new AsciidoctorTableMatcher(title, headers);
@@ -66,7 +67,7 @@ public final class SnippetMatchers {
return new MarkdownTableMatcher(title, headers);
}
- public static HttpRequestMatcher httpRequest(SnippetFormat format,
+ public static HttpRequestMatcher httpRequest(TemplateFormat format,
RequestMethod requestMethod, String uri) {
if ("adoc".equals(format.getFileExtension())) {
return new HttpRequestMatcher(requestMethod, uri,
@@ -76,7 +77,8 @@ public final class SnippetMatchers {
"http"), 2);
}
- public static HttpResponseMatcher httpResponse(SnippetFormat format, HttpStatus status) {
+ public static HttpResponseMatcher httpResponse(TemplateFormat format,
+ HttpStatus status) {
if ("adoc".equals(format.getFileExtension())) {
return new HttpResponseMatcher(status, new AsciidoctorCodeBlockMatcher<>(
"http"), 3);
@@ -85,7 +87,7 @@ public final class SnippetMatchers {
}
@SuppressWarnings({ "rawtypes" })
- public static CodeBlockMatcher> codeBlock(SnippetFormat format, String language) {
+ public static CodeBlockMatcher> codeBlock(TemplateFormat format, String language) {
if ("adoc".equals(format.getFileExtension())) {
return new AsciidoctorCodeBlockMatcher(language);
}
@@ -95,12 +97,12 @@ public final class SnippetMatchers {
private static abstract class AbstractSnippetContentMatcher extends
BaseMatcher {
- private final SnippetFormat snippetFormat;
+ private final TemplateFormat templateFormat;
private List lines = new ArrayList<>();
- protected AbstractSnippetContentMatcher(SnippetFormat snippetFormat) {
- this.snippetFormat = snippetFormat;
+ protected AbstractSnippetContentMatcher(TemplateFormat templateFormat) {
+ this.templateFormat = templateFormat;
}
protected void addLine(String line) {
@@ -121,7 +123,7 @@ public final class SnippetMatchers {
@Override
public void describeTo(Description description) {
- description.appendText(this.snippetFormat.getFileExtension() + " snippet");
+ description.appendText(this.templateFormat.getFileExtension() + " snippet");
description.appendText(getLinesAsString());
}
@@ -157,8 +159,8 @@ public final class SnippetMatchers {
public static class CodeBlockMatcher> extends
AbstractSnippetContentMatcher {
- protected CodeBlockMatcher(SnippetFormat snippetFormat) {
- super(snippetFormat);
+ protected CodeBlockMatcher(TemplateFormat templateFormat) {
+ super(templateFormat);
}
@SuppressWarnings("unchecked")
@@ -178,7 +180,7 @@ public final class SnippetMatchers {
extends CodeBlockMatcher {
protected AsciidoctorCodeBlockMatcher(String language) {
- super(SnippetFormats.asciidoctor());
+ super(TemplateFormats.asciidoctor());
this.addLine("[source," + language + "]");
this.addLine("----");
this.addLine("----");
@@ -195,7 +197,7 @@ public final class SnippetMatchers {
extends CodeBlockMatcher {
protected MarkdownCodeBlockMatcher(String language) {
- super(SnippetFormats.markdown());
+ super(TemplateFormats.markdown());
this.addLine("```" + language);
this.addLine("```");
}
@@ -286,8 +288,8 @@ public final class SnippetMatchers {
public static abstract class TableMatcher> extends
AbstractSnippetContentMatcher {
- protected TableMatcher(SnippetFormat snippetFormat) {
- super(snippetFormat);
+ protected TableMatcher(TemplateFormat templateFormat) {
+ super(templateFormat);
}
public abstract T row(String... entries);
@@ -303,7 +305,7 @@ public final class SnippetMatchers {
TableMatcher {
private AsciidoctorTableMatcher(String title, String... columns) {
- super(SnippetFormats.asciidoctor());
+ super(TemplateFormats.asciidoctor());
if (StringUtils.hasText(title)) {
this.addLine("." + title);
}
@@ -340,7 +342,7 @@ public final class SnippetMatchers {
TableMatcher {
private MarkdownTableMatcher(String title, String... columns) {
- super(SnippetFormats.asciidoctor());
+ super(TemplateFormats.asciidoctor());
if (StringUtils.hasText(title)) {
this.addLine(title);
}
@@ -379,12 +381,12 @@ public final class SnippetMatchers {
*/
public static final class SnippetMatcher extends BaseMatcher {
- private final SnippetFormat snippetFormat;
+ private final TemplateFormat templateFormat;
private Matcher expectedContents;
- private SnippetMatcher(SnippetFormat snippetFormat) {
- this.snippetFormat = snippetFormat;
+ private SnippetMatcher(TemplateFormat templateFormat) {
+ this.templateFormat = templateFormat;
}
@Override
@@ -435,8 +437,8 @@ public final class SnippetMatchers {
this.expectedContents.describeTo(description);
}
else {
- description
- .appendText(this.snippetFormat.getFileExtension() + " snippet");
+ description.appendText(this.templateFormat.getFileExtension()
+ + " snippet");
}
}
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/curl-request-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/curl-request-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/curl-request-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/curl-request-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/http-request-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/http-request-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/http-request-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/http-request-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/http-response-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/http-response-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/http-response-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/http-response-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/links-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/links-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/links-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/links-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/links-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/links-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/links-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/links-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/path-parameters-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/path-parameters-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/path-parameters-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/path-parameters-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/path-parameters-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/path-parameters-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/path-parameters-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/path-parameters-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-list-description.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-list-description.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-list-description.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-list-description.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-fields-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-fields-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-headers-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-headers-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-headers-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-headers-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-headers-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-headers-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-headers-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-headers-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-parameters-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-parameters-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-parameters-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-parameters-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-parameters-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-parameters-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/request-parameters-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/request-parameters-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-fields-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-fields-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-fields-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-fields-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-fields-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-fields-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-fields-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-fields-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-headers-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-headers-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-headers-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-headers-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-headers-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-headers-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/adoc/response-headers-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/asciidoctor/response-headers-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/curl-request-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/curl-request-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/curl-request-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/curl-request-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/http-request-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/http-request-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/http-request-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/http-request-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/http-response-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/http-response-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/http-response-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/http-response-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/links-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/links-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/links-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/links-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/links-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/links-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/links-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/links-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/path-parameters-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/path-parameters-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/path-parameters-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/path-parameters-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/path-parameters-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/path-parameters-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/path-parameters-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/path-parameters-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-fields-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-fields-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-fields-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-fields-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-fields-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-fields-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-fields-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-fields-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-headers-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-headers-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-headers-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-headers-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-headers-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-headers-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-headers-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-headers-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-parameters-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-parameters-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-parameters-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-parameters-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-parameters-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-parameters-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/request-parameters-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/request-parameters-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-fields-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-fields-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-fields-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-fields-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-fields-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-fields-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-fields-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-fields-with-title.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-headers-with-extra-column.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-headers-with-extra-column.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-headers-with-extra-column.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-headers-with-extra-column.snippet
diff --git a/spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-headers-with-title.snippet b/spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-headers-with-title.snippet
similarity index 100%
rename from spring-restdocs-core/src/test/resources/custom-snippet-templates/md/response-headers-with-title.snippet
rename to spring-restdocs-core/src/test/resources/custom-snippet-templates/markdown/response-headers-with-title.snippet
diff --git a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
index 0c48c480..ac83d971 100644
--- a/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
+++ b/spring-restdocs-mockmvc/src/test/java/org/springframework/restdocs/mockmvc/MockMvcRestDocumentationIntegrationTests.java
@@ -75,8 +75,8 @@ import static org.springframework.restdocs.request.RequestDocumentation.pathPara
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
import static org.springframework.restdocs.snippet.Attributes.attributes;
import static org.springframework.restdocs.snippet.Attributes.key;
-import static org.springframework.restdocs.snippet.SnippetFormats.asciidoctor;
-import static org.springframework.restdocs.snippet.SnippetFormats.markdown;
+import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
+import static org.springframework.restdocs.templates.TemplateFormats.markdown;
import static org.springframework.restdocs.test.SnippetMatchers.codeBlock;
import static org.springframework.restdocs.test.SnippetMatchers.httpRequest;
import static org.springframework.restdocs.test.SnippetMatchers.httpResponse;
@@ -130,7 +130,7 @@ public class MockMvcRestDocumentationIntegrationTests {
MockMvc mockMvc = MockMvcBuilders
.webAppContextSetup(this.context)
.apply(new MockMvcRestDocumentationConfigurer(this.restDocumentation)
- .snippets().withEncoding("UTF-8").withFormat(markdown())).build();
+ .snippets().withEncoding("UTF-8").withTemplateFormat(markdown())).build();
mockMvc.perform(get("/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(document("basic-markdown"));
diff --git a/spring-restdocs-restassured/src/test/java/org/springframework/restdocs/restassured/RestAssuredRestDocumentationIntegrationTests.java b/spring-restdocs-restassured/src/test/java/org/springframework/restdocs/restassured/RestAssuredRestDocumentationIntegrationTests.java
index eeea60b4..ff3084d8 100644
--- a/spring-restdocs-restassured/src/test/java/org/springframework/restdocs/restassured/RestAssuredRestDocumentationIntegrationTests.java
+++ b/spring-restdocs-restassured/src/test/java/org/springframework/restdocs/restassured/RestAssuredRestDocumentationIntegrationTests.java
@@ -70,7 +70,7 @@ import static org.springframework.restdocs.request.RequestDocumentation.requestP
import static org.springframework.restdocs.restassured.RestAssuredRestDocumentation.document;
import static org.springframework.restdocs.restassured.RestAssuredRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.restassured.operation.preprocess.RestAssuredPreprocessors.modifyUris;
-import static org.springframework.restdocs.snippet.SnippetFormats.asciidoctor;
+import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
import static org.springframework.restdocs.test.SnippetMatchers.codeBlock;
import static org.springframework.restdocs.test.SnippetMatchers.httpRequest;
import static org.springframework.restdocs.test.SnippetMatchers.httpResponse;