Commit f94ce495 authored by Johnny Lim's avatar Johnny Lim Committed by Madhura Bhave

Fix parameter order for RequestMatcherAssert.doesNotMatch()

Closes gh-13707
parent 177c54d4
...@@ -78,14 +78,15 @@ public class EndpointRequestTests { ...@@ -78,14 +78,15 @@ public class EndpointRequestTests {
@Test @Test
public void toAnyEndpointWhenServletPathNotEmptyShouldMatch() { public void toAnyEndpointWhenServletPathNotEmptyShouldMatch() {
RequestMatcher matcher = EndpointRequest.toAnyEndpoint(); RequestMatcher matcher = EndpointRequest.toAnyEndpoint();
assertMatcher(matcher, "/actuator", "/spring", "/admin").matches("/actuator/foo", assertMatcher(matcher, "/actuator", "/spring", "/admin")
"/spring", "/admin"); .matches(Arrays.asList("/spring", "/admin"), "/actuator/foo");
assertMatcher(matcher, "/actuator", "/spring", "/admin").matches("/actuator/bar", assertMatcher(matcher, "/actuator", "/spring", "/admin")
"/spring", "/admin"); .matches(Arrays.asList("/spring", "/admin"), "/actuator/bar");
assertMatcher(matcher, "/actuator", "/spring").matches("/actuator", "/spring"); assertMatcher(matcher, "/actuator", "/spring").matches(Arrays.asList("/spring"),
assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("/actuator/baz", "/actuator");
"/spring"); assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("/spring",
assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("/actuator/foo", ""); "/actuator/baz");
assertMatcher(matcher, "/actuator", "/spring").doesNotMatch("", "/actuator/foo");
} }
@Test @Test
...@@ -279,8 +280,8 @@ public class EndpointRequestTests { ...@@ -279,8 +280,8 @@ public class EndpointRequestTests {
matches(mockRequest(servletPath)); matches(mockRequest(servletPath));
} }
public void matches(String pathInfo, String... servletPaths) { public void matches(List<String> servletPaths, String pathInfo) {
Arrays.stream(servletPaths).forEach((p) -> matches(mockRequest(p, pathInfo))); servletPaths.forEach((p) -> matches(mockRequest(p, pathInfo)));
} }
private void matches(HttpServletRequest request) { private void matches(HttpServletRequest request) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment