@Test
@DataProvider(value = {
"GET,POST | GET | true",
"GET,POST | POST | true",
"GET,POST | PUT | false",
"GET,POST | null | false"
}, splitBy = "\\|")
public void matchesMethod_works_as_expected_for_known_data(String matcherMethodStrings, String requestMethodString, boolean expectedMatchValue) {
List<HttpMethod> matcherMethods = Arrays.asList(matcherMethodStrings.split(",")).stream().map(HttpMethod::valueOf).collect(Collectors.toList());
Collection<String> paths = new ArrayList<String>() {{ add("/foo"); }};
MultiMatcher matcher = MultiMatcher.match(paths, matcherMethods);
RequestInfo<?> requestInfo = RequestInfoImpl.dummyInstanceForUnknownRequests();
if (requestMethodString == null)
Whitebox.setInternalState(requestInfo, "method", null);
else
Whitebox.setInternalState(requestInfo, "method", HttpMethod.valueOf(requestMethodString));
assertThat(matcher.matchesMethod(requestInfo), is(expectedMatchValue));
}
}