5656
5757public class SectionSnippetTest {
5858
59+ private static final String LINE_SEPERATOR = System .lineSeparator ();
5960 private JavadocReader javadocReader ;
6061
6162 @ Rule
@@ -85,10 +86,10 @@ public void noSnippets() throws Exception {
8586 mockMethodTitle (TestResource .class , "getItemById" , "" );
8687
8788 this .snippets .expect (SECTION )
88- .withContents (equalTo ("[[resources-noSnippets]]\n " +
89- "=== Get Item By Id\n \n " +
90- "include::auto-method-path.adoc[]\n \n " +
91- "include::auto-description.adoc[]\n " ));
89+ .withContents (equalTo ("[[resources-noSnippets]]" + LINE_SEPERATOR +
90+ "=== Get Item By Id" + LINE_SEPERATOR + LINE_SEPERATOR +
91+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
92+ "include::auto-description.adoc[]" + LINE_SEPERATOR ));
9293
9394 new SectionBuilder ()
9495 .snippetNames ()
@@ -104,10 +105,10 @@ public void noSnippets() throws Exception {
104105 @ Test
105106 public void noHandlerMethod () throws Exception {
106107 this .snippets .expect (SECTION )
107- .withContents (equalTo ("[[resources-noHandlerMethod]]\n " +
108- "=== No Handler Method\n \n " +
109- "include::auto-method-path.adoc[]\n \n " +
110- "include::auto-description.adoc[]\n " ));
108+ .withContents (equalTo ("[[resources-noHandlerMethod]]" + LINE_SEPERATOR +
109+ "=== No Handler Method" + LINE_SEPERATOR + LINE_SEPERATOR +
110+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
111+ "include::auto-description.adoc[]" + LINE_SEPERATOR ));
111112
112113 new SectionBuilder ()
113114 .snippetNames ()
@@ -125,24 +126,24 @@ public void defaultSnippets() throws Exception {
125126 mockMethodTitle (TestResource .class , "getItemById" , "" );
126127
127128 this .snippets .expect (SECTION )
128- .withContents (equalTo ("[[resources-defaultSnippets]]\n " +
129- "=== Get Item By Id\n \n " +
130- "include::auto-method-path.adoc[]\n \n " +
131- "include::auto-description.adoc[]\n \n " +
132- "==== Authorization\n \n " +
133- "include::auto-authorization.adoc[]\n \n " +
134- "==== Path parameters\n \n " +
135- "include::auto-path-parameters.adoc[]\n \n " +
136- "==== Query parameters\n \n " +
137- "include::auto-request-parameters.adoc[]\n \n " +
138- "==== Request fields\n \n " +
139- "include::auto-request-fields.adoc[]\n \n " +
140- "==== Response fields\n \n " +
141- "include::auto-response-fields.adoc[]\n \n " +
142- "==== Example request\n \n " +
143- "include::curl-request.adoc[]\n \n " +
144- "==== Example response\n \n " +
145- "include::http-response.adoc[]\n " ));
129+ .withContents (equalTo ("[[resources-defaultSnippets]]" + LINE_SEPERATOR +
130+ "=== Get Item By Id" + LINE_SEPERATOR + LINE_SEPERATOR +
131+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
132+ "include::auto-description.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
133+ "==== Authorization" + LINE_SEPERATOR + LINE_SEPERATOR +
134+ "include::auto-authorization.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
135+ "==== Path parameters" + LINE_SEPERATOR + LINE_SEPERATOR +
136+ "include::auto-path-parameters.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
137+ "==== Query parameters" + LINE_SEPERATOR + LINE_SEPERATOR +
138+ "include::auto-request-parameters.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
139+ "==== Request fields" + LINE_SEPERATOR + LINE_SEPERATOR +
140+ "include::auto-request-fields.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
141+ "==== Response fields" + LINE_SEPERATOR + LINE_SEPERATOR +
142+ "include::auto-response-fields.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
143+ "==== Example request" + LINE_SEPERATOR + LINE_SEPERATOR +
144+ "include::curl-request.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
145+ "==== Example response" + LINE_SEPERATOR + LINE_SEPERATOR +
146+ "include::http-response.adoc[]" + LINE_SEPERATOR ));
146147
147148 new SectionBuilder ().build ()
148149 .document (operationBuilder
@@ -162,16 +163,16 @@ public void customSnippets() throws Exception {
162163 mockMethodTitle (TestResource .class , "getItemById" , "" );
163164
164165 this .snippets .expect (SECTION )
165- .withContents (equalTo ("[[resources-customSnippets]]\n " +
166- "=== Get Item By Id\n \n " +
167- "include::auto-method-path.adoc[]\n \n " +
168- "include::auto-description.adoc[]\n \n " +
169- "==== Example response\n \n " +
170- "include::http-response.adoc[]\n \n " +
171- "==== Response fields\n \n " +
172- "include::auto-response-fields.adoc[]\n \n " +
173- "==== Example request\n \n " +
174- "include::http-request.adoc[]\n " ));
166+ .withContents (equalTo ("[[resources-customSnippets]]" + LINE_SEPERATOR +
167+ "=== Get Item By Id" + LINE_SEPERATOR + LINE_SEPERATOR +
168+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
169+ "include::auto-description.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
170+ "==== Example response" + LINE_SEPERATOR + LINE_SEPERATOR +
171+ "include::http-response.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
172+ "==== Response fields" + LINE_SEPERATOR + LINE_SEPERATOR +
173+ "include::auto-response-fields.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
174+ "==== Example request" + LINE_SEPERATOR + LINE_SEPERATOR +
175+ "include::http-request.adoc[]" + LINE_SEPERATOR ));
175176
176177 new SectionBuilder ()
177178 .snippetNames (HTTP_RESPONSE , RESPONSE_FIELDS , HTTP_REQUEST )
@@ -193,16 +194,16 @@ public void skipEmpty() throws Exception {
193194 mockMethodTitle (TestResource .class , "getItemById" , "" );
194195
195196 this .snippets .expect (SECTION )
196- .withContents (equalTo ("[[resources-skipEmpty]]\n " +
197- "=== Get Item By Id\n \n " +
198- "include::auto-method-path.adoc[]\n \n " +
199- "include::auto-description.adoc[]\n \n " +
200- "==== Authorization\n \n " +
201- "include::auto-authorization.adoc[]\n \n " +
202- "==== Example request\n \n " +
203- "include::curl-request.adoc[]\n \n " +
204- "==== Example response\n \n " +
205- "include::http-response.adoc[]\n " ));
197+ .withContents (equalTo ("[[resources-skipEmpty]]" + LINE_SEPERATOR +
198+ "=== Get Item By Id" + LINE_SEPERATOR + LINE_SEPERATOR +
199+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
200+ "include::auto-description.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
201+ "==== Authorization" + LINE_SEPERATOR + LINE_SEPERATOR +
202+ "include::auto-authorization.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
203+ "==== Example request" + LINE_SEPERATOR + LINE_SEPERATOR +
204+ "include::curl-request.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
205+ "==== Example response" + LINE_SEPERATOR + LINE_SEPERATOR +
206+ "include::http-response.adoc[]" + LINE_SEPERATOR ));
206207
207208 new SectionBuilder ()
208209 .skipEmpty (true )
@@ -224,10 +225,10 @@ public void customTitle() throws Exception {
224225 mockMethodTitle (TestResource .class , "getItemById" , "Custom title" );
225226
226227 this .snippets .expect (SECTION )
227- .withContents (equalTo ("[[resources-customTitle]]\n " +
228- "=== Custom title\n \n " +
229- "include::auto-method-path.adoc[]\n \n " +
230- "include::auto-description.adoc[]\n " ));
228+ .withContents (equalTo ("[[resources-customTitle]]" + LINE_SEPERATOR +
229+ "=== Custom title" + LINE_SEPERATOR + LINE_SEPERATOR +
230+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
231+ "include::auto-description.adoc[]" + LINE_SEPERATOR ));
231232
232233 new SectionBuilder ()
233234 .snippetNames ()
@@ -249,10 +250,10 @@ public void deprecated() throws Exception {
249250
250251
251252 this .snippets .expect (SECTION )
252- .withContents (equalTo ("[[resources-deprecated]]\n " +
253- "=== Get Item By Id (deprecated)\n \n " +
254- "include::auto-method-path.adoc[]\n \n " +
255- "include::auto-description.adoc[]\n " ));
253+ .withContents (equalTo ("[[resources-deprecated]]" + LINE_SEPERATOR +
254+ "=== Get Item By Id (deprecated)" + LINE_SEPERATOR + LINE_SEPERATOR +
255+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
256+ "include::auto-description.adoc[]" + LINE_SEPERATOR ));
256257
257258 new SectionBuilder ()
258259 .snippetNames ()
@@ -273,24 +274,24 @@ public void translation() throws Exception {
273274 mockMethodTitle (TestResource .class , "getItemById" , "" );
274275
275276 this .snippets .expect (SECTION )
276- .withContents (equalTo ("[[resources-translation]]\n " +
277- "=== Get Item By Id\n \n " +
278- "include::auto-method-path.adoc[]\n \n " +
279- "include::auto-description.adoc[]\n \n " +
280- "==== XAuthorization\n \n " +
281- "include::auto-authorization.adoc[]\n \n " +
282- "==== XPath parameters\n \n " +
283- "include::auto-path-parameters.adoc[]\n \n " +
284- "==== XQuery parameters\n \n " +
285- "include::auto-request-parameters.adoc[]\n \n " +
286- "==== XRequest fields\n \n " +
287- "include::auto-request-fields.adoc[]\n \n " +
288- "==== XResponse fields\n \n " +
289- "include::auto-response-fields.adoc[]\n \n " +
290- "==== XExample request\n \n " +
291- "include::curl-request.adoc[]\n \n " +
292- "==== XExample response\n \n " +
293- "include::http-response.adoc[]\n " ));
277+ .withContents (equalTo ("[[resources-translation]]" + LINE_SEPERATOR +
278+ "=== Get Item By Id" + LINE_SEPERATOR + LINE_SEPERATOR +
279+ "include::auto-method-path.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
280+ "include::auto-description.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
281+ "==== XAuthorization" + LINE_SEPERATOR + LINE_SEPERATOR +
282+ "include::auto-authorization.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
283+ "==== XPath parameters" + LINE_SEPERATOR + LINE_SEPERATOR +
284+ "include::auto-path-parameters.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
285+ "==== XQuery parameters" + LINE_SEPERATOR + LINE_SEPERATOR +
286+ "include::auto-request-parameters.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
287+ "==== XRequest fields" + LINE_SEPERATOR + LINE_SEPERATOR +
288+ "include::auto-request-fields.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
289+ "==== XResponse fields" + LINE_SEPERATOR + LINE_SEPERATOR +
290+ "include::auto-response-fields.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
291+ "==== XExample request" + LINE_SEPERATOR + LINE_SEPERATOR +
292+ "include::curl-request.adoc[]" + LINE_SEPERATOR + LINE_SEPERATOR +
293+ "==== XExample response" + LINE_SEPERATOR + LINE_SEPERATOR +
294+ "include::http-response.adoc[]" + LINE_SEPERATOR ));
294295
295296 new SectionBuilder ().build ()
296297 .document (operationBuilder
0 commit comments