Skip to content

Commit d3e138c

Browse files
Added test scope for NPE in RequestMethod
Signed-off-by: Soumik Sarker <ronodhirsoumik@gmail.com>
1 parent 9126aaf commit d3e138c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

web/src/test/java/org/springframework/security/web/servlet/util/matcher/PathPatternRequestMatcherTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ void matcherWhenBasePathIsRootThenNoDoubleSlash() {
146146
assertThat(matcher.matches(mock)).isTrue();
147147
}
148148

149+
@Test
150+
void matcherWhenRequestMethodIsNullThenNoNullPointerException() {
151+
RequestMatcher matcher = pathPattern(HttpMethod.GET, "/");
152+
MockHttpServletRequest mock = new MockHttpServletRequest(null, "/");
153+
ServletRequestPathUtils.parseAndCache(mock);
154+
assertThat(matcher.matches(mock)).isFalse();
155+
}
156+
149157
MockHttpServletRequest request(String uri) {
150158
MockHttpServletRequest request = new MockHttpServletRequest("GET", uri);
151159
ServletRequestPathUtils.parseAndCache(request);

0 commit comments

Comments
 (0)