diff --git a/spring-restdocs-core/src/main/java/org/springframework/restdocs/templates/TemplateFormats.java b/spring-restdocs-core/src/main/java/org/springframework/restdocs/templates/TemplateFormats.java index 1b76d0c0d..33bc3a68b 100644 --- a/spring-restdocs-core/src/main/java/org/springframework/restdocs/templates/TemplateFormats.java +++ b/spring-restdocs-core/src/main/java/org/springframework/restdocs/templates/TemplateFormats.java @@ -17,7 +17,7 @@ package org.springframework.restdocs.templates; /** - * An enumeration of the built-in formats for which templates are provuded. + * An enumeration of the built-in formats for which templates are provided. * * @author Andy Wilkinson * @since 1.1.0 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 67ea00f0e..faa373158 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 @@ -100,8 +100,8 @@ public void defaultConfiguration() { SnippetConfiguration snippetConfiguration = (SnippetConfiguration) configuration .get(SnippetConfiguration.class.getName()); assertThat(snippetConfiguration.getEncoding(), is(equalTo("UTF-8"))); - assertThat(snippetConfiguration.getTemplateFormat(), - is(equalTo(TemplateFormats.asciidoctor()))); + assertThat(snippetConfiguration.getTemplateFormat().getId(), + is(equalTo(TemplateFormats.asciidoctor().getId()))); OperationRequestPreprocessor defaultOperationRequestPreprocessor = (OperationRequestPreprocessor) configuration .get(RestDocumentationGenerator.ATTRIBUTE_NAME_DEFAULT_OPERATION_REQUEST_PREPROCESSOR); @@ -190,8 +190,8 @@ public void customTemplateFormat() { instanceOf(SnippetConfiguration.class))); SnippetConfiguration snippetConfiguration = (SnippetConfiguration) configuration .get(SnippetConfiguration.class.getName()); - assertThat(snippetConfiguration.getTemplateFormat(), - is(equalTo(TemplateFormats.markdown()))); + assertThat(snippetConfiguration.getTemplateFormat().getId(), + is(equalTo(TemplateFormats.markdown().getId()))); } @SuppressWarnings("unchecked") 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 8b9007bd9..813183052 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 @@ -173,7 +173,7 @@ public void tableCellContentIsEscapedWhenNecessary() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); 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 fbf5887b1..0156812f9 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 @@ -164,7 +164,7 @@ public void tableCellContentIsEscapedWhenNecessary() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); 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 5797dda44..71bf83c03 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 @@ -178,7 +178,7 @@ public void tableCellContentIsEscapedWhenNecessary() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); 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 43eece49f..7ceb2ab69 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 @@ -461,7 +461,7 @@ public void typeDeterminationDoesNotSetTypeOnDescriptor() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); 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 020131df3..9388dd1e2 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 @@ -472,7 +472,7 @@ public void typeDeterminationDoesNotSetTypeOnDescriptor() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); 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 e053430d8..a511ed533 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 @@ -87,8 +87,7 @@ public void allUndocumentedPathParametersCanBeIgnored() throws IOException { public void missingOptionalPathParameter() throws IOException { this.snippets.expectPathParameters() .withContents(tableWithTitleAndHeader( - this.templateFormat == TemplateFormats.asciidoctor() ? "+/{a}+" - : "`/{a}`", + getTitle("/{a}"), "Parameter", "Description").row("`a`", "one").row("`b`", "two")); new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"), parameterWithName("b").description("two").optional())) @@ -101,8 +100,7 @@ public void missingOptionalPathParameter() throws IOException { public void presentOptionalPathParameter() throws IOException { this.snippets.expectPathParameters() .withContents(tableWithTitleAndHeader( - this.templateFormat == TemplateFormats.asciidoctor() ? "+/{a}+" - : "`/{a}`", + getTitle("/{a}"), "Parameter", "Description").row("`a`", "one")); new PathParametersSnippet( Arrays.asList(parameterWithName("a").description("one").optional())) @@ -208,7 +206,7 @@ public void pathParametersWithEscapedContent() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); @@ -219,7 +217,7 @@ private String getTitle() { } private String getTitle(String title) { - if (this.templateFormat.equals(TemplateFormats.asciidoctor())) { + if (this.templateFormat.getId().equals(TemplateFormats.asciidoctor().getId())) { return "+" + title + "+"; } return "`" + title + "`"; 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 3aa98e024..da1fecbe6 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 @@ -200,7 +200,7 @@ public void requestParametersWithEscapedContent() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|"); diff --git a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestPartsSnippetTests.java b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestPartsSnippetTests.java index 2c4954003..9abbd4ac0 100644 --- a/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestPartsSnippetTests.java +++ b/spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestPartsSnippetTests.java @@ -191,7 +191,7 @@ public void requestPartsWithEscapedContent() throws IOException { } private String escapeIfNecessary(String input) { - if (this.templateFormat.equals(TemplateFormats.markdown())) { + if (this.templateFormat.getId().equals(TemplateFormats.markdown().getId())) { return input; } return input.replace("|", "\\|");