Skip to content

Commit cecd2ee

Browse files
committed
Polishing
1 parent 97a89d6 commit cecd2ee

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @author Juergen Hoeller
3434
* @author Costin Leau
3535
*/
36-
public class UrlPathHelperTests {
36+
class UrlPathHelperTests {
3737

3838
private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded";
3939

@@ -43,31 +43,31 @@ public class UrlPathHelperTests {
4343

4444

4545
@Test
46-
public void getPathWithinApplication() {
46+
void getPathWithinApplication() {
4747
request.setContextPath("/petclinic");
4848
request.setRequestURI("/petclinic/welcome.html");
4949

5050
assertThat(helper.getPathWithinApplication(request)).as("Incorrect path returned").isEqualTo("/welcome.html");
5151
}
5252

5353
@Test
54-
public void getPathWithinApplicationForRootWithNoLeadingSlash() {
54+
void getPathWithinApplicationForRootWithNoLeadingSlash() {
5555
request.setContextPath("/petclinic");
5656
request.setRequestURI("/petclinic");
5757

5858
assertThat(helper.getPathWithinApplication(request)).as("Incorrect root path returned").isEqualTo("/");
5959
}
6060

6161
@Test
62-
public void getPathWithinApplicationForSlashContextPath() {
62+
void getPathWithinApplicationForSlashContextPath() {
6363
request.setContextPath("/");
6464
request.setRequestURI("/welcome.html");
6565

6666
assertThat(helper.getPathWithinApplication(request)).as("Incorrect path returned").isEqualTo("/welcome.html");
6767
}
6868

6969
@Test
70-
public void getPathWithinServlet() {
70+
void getPathWithinServlet() {
7171
request.setContextPath("/petclinic");
7272
request.setServletPath("/main");
7373
request.setRequestURI("/petclinic/main/welcome.html");
@@ -76,7 +76,7 @@ public void getPathWithinServlet() {
7676
}
7777

7878
@Test
79-
public void alwaysUseFullPath() {
79+
void alwaysUseFullPath() {
8080
helper.setAlwaysUseFullPath(true);
8181
request.setContextPath("/petclinic");
8282
request.setServletPath("/main");
@@ -88,7 +88,7 @@ public void alwaysUseFullPath() {
8888
// SPR-11101
8989

9090
@Test
91-
public void getPathWithinServletWithoutUrlDecoding() {
91+
void getPathWithinServletWithoutUrlDecoding() {
9292
request.setContextPath("/SPR-11101");
9393
request.setServletPath("/test_url_decoding/a/b");
9494
request.setRequestURI("/test_url_decoding/a%2Fb");
@@ -100,7 +100,7 @@ public void getPathWithinServletWithoutUrlDecoding() {
100100
}
101101

102102
@Test
103-
public void getRequestUri() {
103+
void getRequestUri() {
104104
request.setRequestURI("/welcome.html");
105105
assertThat(helper.getRequestUri(request)).as("Incorrect path returned").isEqualTo("/welcome.html");
106106

@@ -112,7 +112,7 @@ public void getRequestUri() {
112112
}
113113

114114
@Test
115-
public void getRequestRemoveSemicolonContent() throws UnsupportedEncodingException {
115+
void getRequestRemoveSemicolonContent() throws UnsupportedEncodingException {
116116
helper.setRemoveSemicolonContent(true);
117117

118118
request.setRequestURI("/foo;f=F;o=O;o=O/bar;b=B;a=A;r=R");
@@ -127,7 +127,7 @@ public void getRequestRemoveSemicolonContent() throws UnsupportedEncodingExcepti
127127
}
128128

129129
@Test
130-
public void getRequestKeepSemicolonContent() {
130+
void getRequestKeepSemicolonContent() {
131131
helper.setRemoveSemicolonContent(false);
132132

133133
testKeepSemicolonContent("/foo;a=b;c=d", "/foo;a=b;c=d");
@@ -146,7 +146,7 @@ private void testKeepSemicolonContent(String requestUri, String expectedPath) {
146146
}
147147

148148
@Test
149-
public void getLookupPathWithSemicolonContent() {
149+
void getLookupPathWithSemicolonContent() {
150150
helper.setRemoveSemicolonContent(false);
151151

152152
request.setContextPath("/petclinic");
@@ -157,7 +157,7 @@ public void getLookupPathWithSemicolonContent() {
157157
}
158158

159159
@Test
160-
public void getLookupPathWithSemicolonContentAndNullPathInfo() {
160+
void getLookupPathWithSemicolonContentAndNullPathInfo() {
161161
helper.setRemoveSemicolonContent(false);
162162

163163
request.setContextPath("/petclinic");
@@ -168,7 +168,7 @@ public void getLookupPathWithSemicolonContentAndNullPathInfo() {
168168
}
169169

170170
@Test // gh-27303
171-
public void defaultInstanceReadOnlyBehavior() {
171+
void defaultInstanceReadOnlyBehavior() {
172172
UrlPathHelper helper = UrlPathHelper.defaultInstance;
173173

174174
assertThatIllegalArgumentException()
@@ -200,7 +200,7 @@ public void defaultInstanceReadOnlyBehavior() {
200200
//
201201

202202
@Test
203-
public void tomcatDefaultServletRoot() throws Exception {
203+
void tomcatDefaultServletRoot() throws Exception {
204204
request.setContextPath("/test");
205205
request.setPathInfo(null);
206206
request.setServletPath("/");
@@ -209,7 +209,7 @@ public void tomcatDefaultServletRoot() throws Exception {
209209
}
210210

211211
@Test
212-
public void tomcatDefaultServletFile() throws Exception {
212+
void tomcatDefaultServletFile() throws Exception {
213213
request.setContextPath("/test");
214214
request.setPathInfo(null);
215215
request.setServletPath("/foo");
@@ -219,7 +219,7 @@ public void tomcatDefaultServletFile() throws Exception {
219219
}
220220

221221
@Test
222-
public void tomcatDefaultServletFolder() throws Exception {
222+
void tomcatDefaultServletFolder() throws Exception {
223223
request.setContextPath("/test");
224224
request.setPathInfo(null);
225225
request.setServletPath("/foo/");
@@ -230,7 +230,7 @@ public void tomcatDefaultServletFolder() throws Exception {
230230

231231
//SPR-12372 & SPR-13455
232232
@Test
233-
public void removeDuplicateSlashesInPath() throws Exception {
233+
void removeDuplicateSlashesInPath() throws Exception {
234234
request.setContextPath("/SPR-12372");
235235
request.setPathInfo(null);
236236
request.setServletPath("/foo/bar/");
@@ -251,7 +251,7 @@ public void removeDuplicateSlashesInPath() throws Exception {
251251
}
252252

253253
@Test
254-
public void wasDefaultServletRoot() throws Exception {
254+
void wasDefaultServletRoot() throws Exception {
255255
request.setContextPath("/test");
256256
request.setPathInfo("/");
257257
request.setServletPath("");
@@ -262,13 +262,13 @@ public void wasDefaultServletRoot() throws Exception {
262262
}
263263

264264
@Test
265-
public void wasDefaultServletRootWithCompliantSetting() throws Exception {
265+
void wasDefaultServletRootWithCompliantSetting() throws Exception {
266266
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/");
267267
tomcatDefaultServletRoot();
268268
}
269269

270270
@Test
271-
public void wasDefaultServletFile() throws Exception {
271+
void wasDefaultServletFile() throws Exception {
272272
request.setContextPath("/test");
273273
request.setPathInfo("/foo");
274274
request.setServletPath("");
@@ -279,13 +279,13 @@ public void wasDefaultServletFile() throws Exception {
279279
}
280280

281281
@Test
282-
public void wasDefaultServletFileWithCompliantSetting() throws Exception {
282+
void wasDefaultServletFileWithCompliantSetting() throws Exception {
283283
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
284284
tomcatDefaultServletFile();
285285
}
286286

287287
@Test
288-
public void wasDefaultServletFolder() throws Exception {
288+
void wasDefaultServletFolder() throws Exception {
289289
request.setContextPath("/test");
290290
request.setPathInfo("/foo/");
291291
request.setServletPath("");
@@ -296,7 +296,7 @@ public void wasDefaultServletFolder() throws Exception {
296296
}
297297

298298
@Test
299-
public void wasDefaultServletFolderWithCompliantSetting() throws Exception {
299+
void wasDefaultServletFolderWithCompliantSetting() throws Exception {
300300
UrlPathHelper.websphereComplianceFlag = true;
301301
try {
302302
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
@@ -313,7 +313,7 @@ public void wasDefaultServletFolderWithCompliantSetting() throws Exception {
313313
//
314314

315315
@Test
316-
public void tomcatCasualServletRoot() throws Exception {
316+
void tomcatCasualServletRoot() throws Exception {
317317
request.setContextPath("/test");
318318
request.setPathInfo("/");
319319
request.setServletPath("/foo");
@@ -323,9 +323,9 @@ public void tomcatCasualServletRoot() throws Exception {
323323
}
324324

325325
@Disabled
326-
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
327326
@Test
328-
public void tomcatCasualServletRootWithMissingSlash() throws Exception {
327+
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
328+
void tomcatCasualServletRootWithMissingSlash() throws Exception {
329329
request.setContextPath("/test");
330330
request.setPathInfo(null);
331331
request.setServletPath("/foo");
@@ -335,7 +335,7 @@ public void tomcatCasualServletRootWithMissingSlash() throws Exception {
335335
}
336336

337337
@Test
338-
public void tomcatCasualServletFile() throws Exception {
338+
void tomcatCasualServletFile() throws Exception {
339339
request.setContextPath("/test");
340340
request.setPathInfo("/foo");
341341
request.setServletPath("/foo");
@@ -345,7 +345,7 @@ public void tomcatCasualServletFile() throws Exception {
345345
}
346346

347347
@Test
348-
public void tomcatCasualServletFolder() throws Exception {
348+
void tomcatCasualServletFolder() throws Exception {
349349
request.setContextPath("/test");
350350
request.setPathInfo("/foo/");
351351
request.setServletPath("/foo");
@@ -355,7 +355,7 @@ public void tomcatCasualServletFolder() throws Exception {
355355
}
356356

357357
@Test
358-
public void wasCasualServletRoot() throws Exception {
358+
void wasCasualServletRoot() throws Exception {
359359
request.setContextPath("/test");
360360
request.setPathInfo(null);
361361
request.setServletPath("/foo/");
@@ -366,15 +366,15 @@ public void wasCasualServletRoot() throws Exception {
366366
}
367367

368368
@Test
369-
public void wasCasualServletRootWithCompliantSetting() throws Exception {
369+
void wasCasualServletRootWithCompliantSetting() throws Exception {
370370
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/");
371371
tomcatCasualServletRoot();
372372
}
373373

374374
@Disabled
375-
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
376375
@Test
377-
public void wasCasualServletRootWithMissingSlash() throws Exception {
376+
// test the root mapping for /foo/* w/o a trailing slash - <host>/<context>/foo
377+
void wasCasualServletRootWithMissingSlash() throws Exception {
378378
request.setContextPath("/test");
379379
request.setPathInfo(null);
380380
request.setServletPath("/foo");
@@ -386,13 +386,13 @@ public void wasCasualServletRootWithMissingSlash() throws Exception {
386386

387387
@Disabled
388388
@Test
389-
public void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception {
389+
void wasCasualServletRootWithMissingSlashWithCompliantSetting() throws Exception {
390390
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo");
391391
tomcatCasualServletRootWithMissingSlash();
392392
}
393393

394394
@Test
395-
public void wasCasualServletFile() throws Exception {
395+
void wasCasualServletFile() throws Exception {
396396
request.setContextPath("/test");
397397
request.setPathInfo("/foo");
398398
request.setServletPath("/foo");
@@ -403,13 +403,13 @@ public void wasCasualServletFile() throws Exception {
403403
}
404404

405405
@Test
406-
public void wasCasualServletFileWithCompliantSetting() throws Exception {
406+
void wasCasualServletFileWithCompliantSetting() throws Exception {
407407
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo");
408408
tomcatCasualServletFile();
409409
}
410410

411411
@Test
412-
public void wasCasualServletFolder() throws Exception {
412+
void wasCasualServletFolder() throws Exception {
413413
request.setContextPath("/test");
414414
request.setPathInfo("/foo/");
415415
request.setServletPath("/foo");
@@ -420,47 +420,47 @@ public void wasCasualServletFolder() throws Exception {
420420
}
421421

422422
@Test
423-
public void wasCasualServletFolderWithCompliantSetting() throws Exception {
423+
void wasCasualServletFolderWithCompliantSetting() throws Exception {
424424
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo/");
425425
tomcatCasualServletFolder();
426426
}
427427

428428
@Test
429-
public void getOriginatingRequestUri() {
429+
void getOriginatingRequestUri() {
430430
request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path");
431431
request.setRequestURI("/forwarded");
432432
assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/path");
433433
}
434434

435435
@Test
436-
public void getOriginatingRequestUriWebsphere() {
436+
void getOriginatingRequestUriWebsphere() {
437437
request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/path");
438438
request.setRequestURI("/forwarded");
439439
assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/path");
440440
}
441441

442442
@Test
443-
public void getOriginatingRequestUriDefault() {
443+
void getOriginatingRequestUriDefault() {
444444
request.setRequestURI("/forwarded");
445445
assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/forwarded");
446446
}
447447

448448
@Test
449-
public void getOriginatingQueryString() {
449+
void getOriginatingQueryString() {
450450
request.setQueryString("forward=on");
451451
request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path");
452452
request.setAttribute(WebUtils.FORWARD_QUERY_STRING_ATTRIBUTE, "original=on");
453453
assertThat(this.helper.getOriginatingQueryString(request)).isEqualTo("original=on");
454454
}
455455

456456
@Test
457-
public void getOriginatingQueryStringNotPresent() {
457+
void getOriginatingQueryStringNotPresent() {
458458
request.setQueryString("forward=true");
459459
assertThat(this.helper.getOriginatingQueryString(request)).isEqualTo("forward=true");
460460
}
461461

462462
@Test
463-
public void getOriginatingQueryStringIsNull() {
463+
void getOriginatingQueryStringIsNull() {
464464
request.setQueryString("forward=true");
465465
request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path");
466466
assertThat(this.helper.getOriginatingQueryString(request)).isNull();

0 commit comments

Comments
 (0)