diff --git a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java index 3c1bbd28201..094e33d419f 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java @@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; * @author Juergen Hoeller * @author Costin Leau */ -public class UrlPathHelperTests { +class UrlPathHelperTests { private static final String WEBSPHERE_URI_ATTRIBUTE = "com.ibm.websphere.servlet.uri_non_decoded"; @@ -41,7 +41,7 @@ public class UrlPathHelperTests { @Test - public void getPathWithinApplication() { + void getPathWithinApplication() { request.setContextPath("/petclinic"); request.setRequestURI("/petclinic/welcome.html"); @@ -49,7 +49,7 @@ public class UrlPathHelperTests { } @Test - public void getPathWithinApplicationForRootWithNoLeadingSlash() { + void getPathWithinApplicationForRootWithNoLeadingSlash() { request.setContextPath("/petclinic"); request.setRequestURI("/petclinic"); @@ -57,7 +57,7 @@ public class UrlPathHelperTests { } @Test - public void getPathWithinApplicationForSlashContextPath() { + void getPathWithinApplicationForSlashContextPath() { request.setContextPath("/"); request.setRequestURI("/welcome.html"); @@ -65,7 +65,7 @@ public class UrlPathHelperTests { } @Test - public void getPathWithinServlet() { + void getPathWithinServlet() { request.setContextPath("/petclinic"); request.setServletPath("/main"); request.setRequestURI("/petclinic/main/welcome.html"); @@ -74,7 +74,7 @@ public class UrlPathHelperTests { } @Test - public void alwaysUseFullPath() { + void alwaysUseFullPath() { helper.setAlwaysUseFullPath(true); request.setContextPath("/petclinic"); request.setServletPath("/main"); @@ -84,7 +84,7 @@ public class UrlPathHelperTests { } @Test // SPR-11101 - public void getPathWithinServletWithoutUrlDecoding() { + void getPathWithinServletWithoutUrlDecoding() { request.setContextPath("/SPR-11101"); request.setServletPath("/test_url_decoding/a/b"); request.setRequestURI("/test_url_decoding/a%2Fb"); @@ -96,7 +96,7 @@ public class UrlPathHelperTests { } @Test - public void getRequestUri() { + void getRequestUri() { request.setRequestURI("/welcome.html"); assertThat(helper.getRequestUri(request)).isEqualTo("/welcome.html"); @@ -111,7 +111,7 @@ public class UrlPathHelperTests { } @Test - public void getRequestRemoveSemicolonContent() { + void getRequestRemoveSemicolonContent() { helper.setRemoveSemicolonContent(true); request.setRequestURI("/foo;f=F;o=O;o=O/bar;b=B;a=A;r=R"); assertThat(helper.getRequestUri(request)).isEqualTo("/foo/bar"); @@ -126,7 +126,7 @@ public class UrlPathHelperTests { } @Test - public void getRequestKeepSemicolonContent() { + void getRequestKeepSemicolonContent() { helper.setRemoveSemicolonContent(false); testKeepSemicolonContent("/foo;a=b;c=d", "/foo;a=b;c=d"); @@ -145,7 +145,7 @@ public class UrlPathHelperTests { } @Test - public void getLookupPathWithSemicolonContent() { + void getLookupPathWithSemicolonContent() { helper.setRemoveSemicolonContent(false); request.setContextPath("/petclinic"); @@ -156,7 +156,7 @@ public class UrlPathHelperTests { } @Test - public void getLookupPathWithSemicolonContentAndNullPathInfo() { + void getLookupPathWithSemicolonContentAndNullPathInfo() { helper.setRemoveSemicolonContent(false); request.setContextPath("/petclinic"); @@ -167,7 +167,7 @@ public class UrlPathHelperTests { } @Test // gh-27303 - public void defaultInstanceReadOnlyBehavior() { + void defaultInstanceReadOnlyBehavior() { UrlPathHelper helper = UrlPathHelper.defaultInstance; assertThatExceptionOfType(IllegalArgumentException.class) @@ -199,7 +199,7 @@ public class UrlPathHelperTests { // @Test - public void tomcatDefaultServletRoot() { + void tomcatDefaultServletRoot() { request.setContextPath("/test"); request.setServletPath("/"); request.setPathInfo(null); @@ -208,7 +208,7 @@ public class UrlPathHelperTests { } @Test - public void tomcatDefaultServletFile() { + void tomcatDefaultServletFile() { request.setContextPath("/test"); request.setServletPath("/foo"); request.setPathInfo(null); @@ -218,7 +218,7 @@ public class UrlPathHelperTests { } @Test - public void tomcatDefaultServletFolder() { + void tomcatDefaultServletFolder() { request.setContextPath("/test"); request.setServletPath("/foo/"); request.setPathInfo(null); @@ -228,7 +228,7 @@ public class UrlPathHelperTests { } @Test //SPR-12372, SPR-13455 - public void removeDuplicateSlashesInPath() { + void removeDuplicateSlashesInPath() { request.setContextPath("/SPR-12372"); request.setPathInfo(null); request.setServletPath("/foo/bar/"); @@ -249,7 +249,7 @@ public class UrlPathHelperTests { } @Test - public void wasDefaultServletRoot() { + void wasDefaultServletRoot() { request.setContextPath("/test"); request.setPathInfo("/"); request.setServletPath(""); @@ -260,13 +260,13 @@ public class UrlPathHelperTests { } @Test - public void wasDefaultServletRootWithCompliantSetting() { + void wasDefaultServletRootWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/"); tomcatDefaultServletRoot(); } @Test - public void wasDefaultServletFile() { + void wasDefaultServletFile() { request.setContextPath("/test"); request.setPathInfo("/foo"); request.setServletPath(""); @@ -277,13 +277,13 @@ public class UrlPathHelperTests { } @Test - public void wasDefaultServletFileWithCompliantSetting() { + void wasDefaultServletFileWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo"); tomcatDefaultServletFile(); } @Test - public void wasDefaultServletFolder() { + void wasDefaultServletFolder() { request.setContextPath("/test"); request.setPathInfo("/foo/"); request.setServletPath(""); @@ -294,7 +294,7 @@ public class UrlPathHelperTests { } @Test - public void wasDefaultServletFolderWithCompliantSetting() { + void wasDefaultServletFolderWithCompliantSetting() { UrlPathHelper.websphereComplianceFlag = true; try { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/"); @@ -311,7 +311,7 @@ public class UrlPathHelperTests { // @Test - public void tomcatCasualServletRoot() { + void tomcatCasualServletRoot() { request.setContextPath("/test"); request.setPathInfo("/"); request.setServletPath("/foo"); @@ -321,9 +321,9 @@ public class UrlPathHelperTests { } @Disabled - // test the root mapping for /foo/* w/o a trailing slash - //foo @Test - public void tomcatCasualServletRootWithMissingSlash() { + // test the root mapping for /foo/* w/o a trailing slash - //foo + void tomcatCasualServletRootWithMissingSlash() { request.setContextPath("/test"); request.setPathInfo(null); request.setServletPath("/foo"); @@ -333,7 +333,7 @@ public class UrlPathHelperTests { } @Test - public void tomcatCasualServletFile() { + void tomcatCasualServletFile() { request.setContextPath("/test"); request.setPathInfo("/foo"); request.setServletPath("/foo"); @@ -343,7 +343,7 @@ public class UrlPathHelperTests { } @Test - public void tomcatCasualServletFolder() { + void tomcatCasualServletFolder() { request.setContextPath("/test"); request.setPathInfo("/foo/"); request.setServletPath("/foo"); @@ -353,7 +353,7 @@ public class UrlPathHelperTests { } @Test - public void wasCasualServletRoot() { + void wasCasualServletRoot() { request.setContextPath("/test"); request.setPathInfo(null); request.setServletPath("/foo/"); @@ -364,15 +364,15 @@ public class UrlPathHelperTests { } @Test - public void wasCasualServletRootWithCompliantSetting() { + void wasCasualServletRootWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/"); tomcatCasualServletRoot(); } @Disabled - // test the root mapping for /foo/* w/o a trailing slash - //foo @Test - public void wasCasualServletRootWithMissingSlash() { + // test the root mapping for /foo/* w/o a trailing slash - //foo + void wasCasualServletRootWithMissingSlash() { request.setContextPath("/test"); request.setPathInfo(null); request.setServletPath("/foo"); @@ -384,13 +384,13 @@ public class UrlPathHelperTests { @Disabled @Test - public void wasCasualServletRootWithMissingSlashWithCompliantSetting() { + void wasCasualServletRootWithMissingSlashWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo"); tomcatCasualServletRootWithMissingSlash(); } @Test - public void wasCasualServletFile() { + void wasCasualServletFile() { request.setContextPath("/test"); request.setPathInfo("/foo"); request.setServletPath("/foo"); @@ -401,13 +401,13 @@ public class UrlPathHelperTests { } @Test - public void wasCasualServletFileWithCompliantSetting() { + void wasCasualServletFileWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo"); tomcatCasualServletFile(); } @Test - public void wasCasualServletFolder() { + void wasCasualServletFolder() { request.setContextPath("/test"); request.setPathInfo("/foo/"); request.setServletPath("/foo"); @@ -418,33 +418,33 @@ public class UrlPathHelperTests { } @Test - public void wasCasualServletFolderWithCompliantSetting() { + void wasCasualServletFolderWithCompliantSetting() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/test/foo/foo/"); tomcatCasualServletFolder(); } @Test - public void getOriginatingRequestUri() { + void getOriginatingRequestUri() { request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path"); request.setRequestURI("/forwarded"); assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/path"); } @Test - public void getOriginatingRequestUriWebsphere() { + void getOriginatingRequestUriWebsphere() { request.setAttribute(WEBSPHERE_URI_ATTRIBUTE, "/path"); request.setRequestURI("/forwarded"); assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/path"); } @Test - public void getOriginatingRequestUriDefault() { + void getOriginatingRequestUriDefault() { request.setRequestURI("/forwarded"); assertThat(helper.getOriginatingRequestUri(request)).isEqualTo("/forwarded"); } @Test - public void getOriginatingQueryString() { + void getOriginatingQueryString() { request.setQueryString("forward=on"); request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path"); request.setAttribute(WebUtils.FORWARD_QUERY_STRING_ATTRIBUTE, "original=on"); @@ -452,13 +452,13 @@ public class UrlPathHelperTests { } @Test - public void getOriginatingQueryStringNotPresent() { + void getOriginatingQueryStringNotPresent() { request.setQueryString("forward=true"); assertThat(this.helper.getOriginatingQueryString(request)).isEqualTo("forward=true"); } @Test - public void getOriginatingQueryStringIsNull() { + void getOriginatingQueryStringIsNull() { request.setQueryString("forward=true"); request.setAttribute(WebUtils.FORWARD_REQUEST_URI_ATTRIBUTE, "/path"); assertThat(this.helper.getOriginatingQueryString(request)).isNull();