AntPathRequestMatcher supports UrlPathHelper

Fixes: gh-5846
This commit is contained in:
Rob Winch
2018-09-14 08:58:30 -05:00
parent 17dd95d525
commit 8b19f7a71a
2 changed files with 31 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.web.util.UrlPathHelper;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@@ -38,6 +39,14 @@ public class AntPathRequestMatcherTests {
@Mock
private HttpServletRequest request;
@Test
public void matchesWhenUrlPathHelperThenMatchesOnRequestUri() {
AntPathRequestMatcher matcher = new AntPathRequestMatcher("/foo/bar", null, true, new UrlPathHelper());
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/foo/bar");
assertThat(matcher.matches(request)).isTrue();
}
@Test
public void singleWildcardMatchesAnyPath() {
AntPathRequestMatcher matcher = new AntPathRequestMatcher("/**");