From e9506776f1aaabcd767f44281531518559a2323d Mon Sep 17 00:00:00 2001 From: Josh Cummings <3627351+jzheaux@users.noreply.github.com> Date: Wed, 2 Jul 2025 13:55:04 -0600 Subject: [PATCH] Use PathPatternRequestMatcher in test Issue gh-16887 --- .../security/test/web/support/WebTestUtilsTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java b/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java index f1d973e5f6..491bb609ef 100644 --- a/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java +++ b/test/src/test/java/org/springframework/security/test/web/support/WebTestUtilsTests.java @@ -41,13 +41,13 @@ import org.springframework.security.web.context.SecurityContextRepository; import org.springframework.security.web.csrf.CsrfFilter; import org.springframework.security.web.csrf.CsrfTokenRepository; import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.AnyRequestMatcher; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; +import static org.springframework.security.web.servlet.util.matcher.PathPatternRequestMatcher.pathPattern; @ExtendWith(MockitoExtension.class) public class WebTestUtilsTests { @@ -226,7 +226,7 @@ public class WebTestUtilsTests { SecurityFilterChain filterChain(HttpSecurity http) throws Exception { // @formatter:off http - .securityMatcher(new AntPathRequestMatcher("/willnotmatchthis")); + .securityMatcher(pathPattern("/willnotmatchthis")); return http.build(); // @formatter:on }