mirror of https://github.com/apache/jclouds.git
Adding requestLine check to ensure all HttpRequestComparisonTypes compare endpoints and methods
This commit is contained in:
parent
8163b6ee64
commit
f11518fa1e
|
@ -367,7 +367,8 @@ public abstract class BaseRestClientExpectTest<S> {
|
||||||
*/
|
*/
|
||||||
public boolean httpRequestsAreEqual(HttpRequest a, HttpRequest b) {
|
public boolean httpRequestsAreEqual(HttpRequest a, HttpRequest b) {
|
||||||
try {
|
try {
|
||||||
if (a == null || b == null) {
|
if (a == null || b == null || !Objects.equal(a.getRequestLine(), b.getRequestLine())
|
||||||
|
|| !Objects.equal(a.getHeaders(), b.getHeaders())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (a.getPayload() == null || b.getPayload() == null) {
|
if (a.getPayload() == null || b.getPayload() == null) {
|
||||||
|
@ -405,13 +406,13 @@ public abstract class BaseRestClientExpectTest<S> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return diff.identical() && Objects.equal(a.getHeaders(), b.getHeaders());
|
return diff.identical();
|
||||||
}
|
}
|
||||||
case JSON: {
|
case JSON: {
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
JsonElement payloadA = parser.parse(Strings2.toStringAndClose(a.getPayload().getInput()));
|
JsonElement payloadA = parser.parse(Strings2.toStringAndClose(a.getPayload().getInput()));
|
||||||
JsonElement payloadB = parser.parse(Strings2.toStringAndClose(b.getPayload().getInput()));
|
JsonElement payloadB = parser.parse(Strings2.toStringAndClose(b.getPayload().getInput()));
|
||||||
return Objects.equal(payloadA, payloadB) && Objects.equal(a.getHeaders(), b.getHeaders());
|
return Objects.equal(payloadA, payloadB);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return Objects.equal(a, b);
|
return Objects.equal(a, b);
|
||||||
|
|
Loading…
Reference in New Issue