com.thoughtworks.webstub.stub.matcher.MethodMatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of web-stub Show documentation
Show all versions of web-stub Show documentation
Library for stubbing external HTTP dependencies
The newest version!
package com.thoughtworks.webstub.stub.matcher;
import com.thoughtworks.webstub.config.HttpConfiguration;
import javax.servlet.http.HttpServletRequest;
import static javax.servlet.http.HttpServletResponse.SC_NOT_IMPLEMENTED;
public class MethodMatcher extends RequestPartMatcher {
public MethodMatcher(HttpServletRequest request) {
super(request, SC_NOT_IMPLEMENTED);
}
@Override
public boolean matches(HttpConfiguration configuration) {
return getMethod(configuration).equals(request.getMethod());
}
private String getMethod(HttpConfiguration configuration) {
return configuration.request().method();
}
}