
com.thoughtworks.webstub.config.HttpConfiguration 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
package com.thoughtworks.webstub.config;
import org.apache.commons.lang.builder.EqualsBuilder;
import static java.lang.String.format;
public class HttpConfiguration {
private Request request;
private Response response;
public HttpConfiguration(Request request, Response response) {
this.request = request;
this.response = response;
}
public Request request() {
return request;
}
public Response response() {
return response;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof HttpConfiguration)) return false;
HttpConfiguration that = (HttpConfiguration) o;
return new EqualsBuilder()
.append(request, that.request)
.append(response, that.response)
.isEquals();
}
@Override
public int hashCode() {
int result = request.hashCode();
result = 31 * result + response.hashCode();
return result;
}
@Override
public String toString() {
return format("HttpConfiguration {" +
"method:%s, " +
"uri:%s, " +
"request content:%s, " +
"status:%d, " +
"response content:%s" +
"}", request.method(), request.uri(), request.content(), response.status(), response.content());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy