Skip to content

Commit 276a180

Browse files
committed
Polish
1 parent f0c69ad commit 276a180

File tree

7 files changed

+57
-60
lines changed

7 files changed

+57
-60
lines changed

spring-restdocs-core/src/test/java/org/springframework/restdocs/headers/ResponseHeadersSnippetTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ public void undocumentedResponseHeader() throws IOException {
9191

9292
@Test
9393
public void responseHeadersWithCustomAttributes() throws IOException {
94-
this.snippets.expectResponseHeaders().withContents(containsString("Custom title"));
94+
this.snippets.expectResponseHeaders()
95+
.withContents(containsString("Custom title"));
9596
TemplateResourceResolver resolver = mock(TemplateResourceResolver.class);
9697
given(resolver.resolveTemplateResource("response-headers"))
9798
.willReturn(snippetResource("response-headers-with-title"));
@@ -132,8 +133,7 @@ public void responseHeadersWithCustomDescriptorAttributes() throws IOException {
132133
.response().header("X-Test", "test")
133134
.header("Content-Type",
134135
"application/json")
135-
.header("Etag", "lskjadldj3ii32l2ij23")
136-
.build());
136+
.header("Etag", "lskjadldj3ii32l2ij23").build());
137137
}
138138

139139
@Test

spring-restdocs-core/src/test/java/org/springframework/restdocs/hypermedia/LinksSnippetTests.java

+17-12
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ public void missingOptionalLink() throws IOException {
8888

8989
@Test
9090
public void documentedLinks() throws IOException {
91-
this.snippets.expectLinks().withContents(tableWithHeader("Relation", "Description")
92-
.row("`a`", "one").row("`b`", "two"));
91+
this.snippets.expectLinks()
92+
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
93+
.row("`b`", "two"));
9394
new LinksSnippet(
9495
new StubLinkExtractor().withLinks(new Link("a", "alpha"),
9596
new Link("b", "bravo")),
@@ -100,8 +101,9 @@ public void documentedLinks() throws IOException {
100101

101102
@Test
102103
public void linkDescriptionFromTitleInPayload() throws IOException {
103-
this.snippets.expectLinks().withContents(tableWithHeader("Relation", "Description")
104-
.row("`a`", "one").row("`b`", "Link b"));
104+
this.snippets.expectLinks()
105+
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
106+
.row("`b`", "Link b"));
105107
new LinksSnippet(
106108
new StubLinkExtractor().withLinks(new Link("a", "alpha", "Link a"),
107109
new Link("b", "bravo", "Link b")),
@@ -146,28 +148,31 @@ public void linksWithCustomDescriptorAttributes() throws IOException {
146148
.attributes(key("foo").value("alpha")),
147149
new LinkDescriptor("b").description("two")
148150
.attributes(key("foo").value("bravo"))))
149-
.document(this.operationBuilder.attribute(
150-
TemplateEngine.class.getName(),
151+
.document(this.operationBuilder
152+
.attribute(TemplateEngine.class
153+
.getName(),
151154
new MustacheTemplateEngine(resolver))
152-
.build());
155+
.build());
153156
}
154157

155158
@Test
156159
public void additionalDescriptors() throws IOException {
157-
this.snippets.expectLinks().withContents(tableWithHeader("Relation", "Description")
158-
.row("`a`", "one").row("`b`", "two"));
160+
this.snippets.expectLinks()
161+
.withContents(tableWithHeader("Relation", "Description").row("`a`", "one")
162+
.row("`b`", "two"));
159163
HypermediaDocumentation
160164
.links(new StubLinkExtractor().withLinks(new Link("a", "alpha"),
161165
new Link("b", "bravo")),
162-
new LinkDescriptor("a").description("one"))
166+
new LinkDescriptor("a").description("one"))
163167
.and(new LinkDescriptor("b").description("two"))
164168
.document(this.operationBuilder.build());
165169
}
166170

167171
@Test
168172
public void tableCellContentIsEscapedWhenNecessary() throws IOException {
169-
this.snippets.expectLinks().withContents(tableWithHeader("Relation", "Description")
170-
.row(escapeIfNecessary("`Foo|Bar`"), escapeIfNecessary("one|two")));
173+
this.snippets.expectLinks()
174+
.withContents(tableWithHeader("Relation", "Description").row(
175+
escapeIfNecessary("`Foo|Bar`"), escapeIfNecessary("one|two")));
171176
new LinksSnippet(new StubLinkExtractor().withLinks(new Link("Foo|Bar", "foo")),
172177
Arrays.asList(new LinkDescriptor("Foo|Bar").description("one|two")))
173178
.document(this.operationBuilder.build());

spring-restdocs-core/src/test/java/org/springframework/restdocs/payload/RequestPartFieldsSnippetTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void mapRequestPartFields() throws IOException {
5858
.part("one",
5959
"{\"a\": {\"b\": 5, \"c\": \"charlie\"}}"
6060
.getBytes())
61-
.build());
61+
.build());
6262
}
6363

6464
@Test
@@ -77,7 +77,7 @@ public void mapRequestPartSubsectionFields() throws IOException {
7777
.part("one",
7878
"{\"a\": {\"b\": 5, \"c\": \"charlie\"}}"
7979
.getBytes())
80-
.build());
80+
.build());
8181
}
8282

8383
@Test

spring-restdocs-core/src/test/java/org/springframework/restdocs/request/PathParametersSnippetTests.java

+23-30
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ public void pathParameters() throws IOException {
5353
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
5454
.row("`a`", "one").row("`b`", "two"));
5555
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
56-
parameterWithName("b").description("two")))
57-
.document(this.operationBuilder
58-
.attribute(
59-
RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
60-
"/{a}/{b}")
61-
.build());
56+
parameterWithName("b").description("two"))).document(this.operationBuilder
57+
.attribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
58+
"/{a}/{b}")
59+
.build());
6260
}
6361

6462
@Test
@@ -67,12 +65,10 @@ public void ignoredPathParameter() throws IOException {
6765
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("`b`",
6866
"two"));
6967
new PathParametersSnippet(Arrays.asList(parameterWithName("a").ignored(),
70-
parameterWithName("b").description("two")))
71-
.document(this.operationBuilder
72-
.attribute(
73-
RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
74-
"/{a}/{b}")
75-
.build());
68+
parameterWithName("b").description("two"))).document(this.operationBuilder
69+
.attribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
70+
"/{a}/{b}")
71+
.build());
7672
}
7773

7874
@Test
@@ -81,10 +77,11 @@ public void allUndocumentedPathParametersCanBeIgnored() throws IOException {
8177
tableWithTitleAndHeader(getTitle(), "Parameter", "Description").row("`b`",
8278
"two"));
8379
new PathParametersSnippet(
84-
Arrays.asList(parameterWithName("b").description("two")), true)
85-
.document(this.operationBuilder.attribute(
86-
RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
87-
"/{a}/{b}").build());
80+
Arrays.asList(parameterWithName("b").description("two")),
81+
true).document(this.operationBuilder
82+
.attribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
83+
"/{a}/{b}")
84+
.build());
8885
}
8986

9087
@Test
@@ -117,12 +114,10 @@ public void pathParametersWithQueryString() throws IOException {
117114
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
118115
.row("`a`", "one").row("`b`", "two"));
119116
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
120-
parameterWithName("b").description("two")))
121-
.document(this.operationBuilder
122-
.attribute(
123-
RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
124-
"/{a}/{b}?foo=bar")
125-
.build());
117+
parameterWithName("b").description("two"))).document(this.operationBuilder
118+
.attribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
119+
"/{a}/{b}?foo=bar")
120+
.build());
126121
}
127122

128123
@Test
@@ -131,12 +126,10 @@ public void pathParametersWithQueryStringWithParameters() throws IOException {
131126
tableWithTitleAndHeader(getTitle(), "Parameter", "Description")
132127
.row("`a`", "one").row("`b`", "two"));
133128
new PathParametersSnippet(Arrays.asList(parameterWithName("a").description("one"),
134-
parameterWithName("b").description("two")))
135-
.document(this.operationBuilder
136-
.attribute(
137-
RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
138-
"/{a}/{b}?foo={c}")
139-
.build());
129+
parameterWithName("b").description("two"))).document(this.operationBuilder
130+
.attribute(RestDocumentationGenerator.ATTRIBUTE_NAME_URL_TEMPLATE,
131+
"/{a}/{b}?foo={c}")
132+
.build());
140133
}
141134

142135
@Test
@@ -150,8 +143,8 @@ public void pathParametersWithCustomAttributes() throws IOException {
150143
Arrays.asList(
151144
parameterWithName("a").description("one")
152145
.attributes(key("foo").value("alpha")),
153-
parameterWithName("b").description("two")
154-
.attributes(key("foo").value("bravo"))),
146+
parameterWithName("b").description("two")
147+
.attributes(key("foo").value("bravo"))),
155148
attributes(key("title").value("The title")))
156149
.document(this.operationBuilder
157150
.attribute(

spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestParametersSnippetTests.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,11 @@ public void requestParametersWithCustomAttributes() throws IOException {
117117
.willReturn(snippetResource("request-parameters-with-title"));
118118
this.snippets.expectRequestParameters().withContents(containsString("The title"));
119119

120-
new RequestParametersSnippet(
121-
Arrays.asList(
122-
parameterWithName("a").description("one")
123-
.attributes(key("foo").value("alpha")),
124-
parameterWithName("b").description("two")
125-
.attributes(key("foo").value("bravo"))),
120+
new RequestParametersSnippet(Arrays.asList(
121+
parameterWithName("a").description("one")
122+
.attributes(key("foo").value("alpha")),
123+
parameterWithName("b").description("two")
124+
.attributes(key("foo").value("bravo"))),
126125
attributes(
127126
key("title").value("The title")))
128127
.document(

spring-restdocs-core/src/test/java/org/springframework/restdocs/request/RequestPartsSnippetTests.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,11 @@ public void requestPartsWithCustomAttributes() throws IOException {
108108
.willReturn(snippetResource("request-parts-with-title"));
109109
this.snippets.expectRequestParts().withContents(containsString("The title"));
110110

111-
new RequestPartsSnippet(
112-
Arrays.asList(
113-
partWithName("a").description("one")
114-
.attributes(key("foo").value("alpha")),
115-
partWithName("b").description("two")
116-
.attributes(key("foo").value("bravo"))),
111+
new RequestPartsSnippet(Arrays.asList(
112+
partWithName("a").description("one")
113+
.attributes(key("foo").value("alpha")),
114+
partWithName("b").description("two")
115+
.attributes(key("foo").value("bravo"))),
117116
attributes(
118117
key("title").value("The title")))
119118
.document(

spring-restdocs-core/src/test/java/org/springframework/restdocs/snippet/TemplatedSnippetTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public class TemplatedSnippetTests {
4848
TemplateFormats.asciidoctor());
4949

5050
@Rule
51-
public ExpectedSnippets snippets = new ExpectedSnippets(TemplateFormats.asciidoctor());
51+
public ExpectedSnippets snippets = new ExpectedSnippets(
52+
TemplateFormats.asciidoctor());
5253

5354
@Test
5455
public void attributesAreCopied() {

0 commit comments

Comments
 (0)