@ -145,6 +145,17 @@ public class PathPatternRequestMatcherTests {
@@ -145,6 +145,17 @@ public class PathPatternRequestMatcherTests {
assertThat ( matcher . matches ( mock ) ) . isTrue ( ) ;
}
// gh-18911
@Test
void testEqualsWithSameAndDifferentHttpMethod ( ) {
PathPatternRequestMatcher . Builder builder = PathPatternRequestMatcher . withDefaults ( ) ;
PathPatternRequestMatcher matcher1 = builder . matcher ( HttpMethod . GET , "/foo" ) ;
PathPatternRequestMatcher matcher2 = builder . matcher ( HttpMethod . GET , "/foo" ) ;
PathPatternRequestMatcher matcher3 = builder . matcher ( HttpMethod . POST , "/foo" ) ;
assertThat ( matcher1 ) . isEqualTo ( matcher2 ) ;
assertThat ( matcher1 ) . isNotEqualTo ( matcher3 ) ;
}
MockHttpServletRequest request ( String uri ) {
MockHttpServletRequest request = new MockHttpServletRequest ( "GET" , uri ) ;
ServletRequestPathUtils . parseAndCache ( request ) ;