mirror of https://github.com/apache/jclouds.git
Simplifying BaseRestClientExpectTest's comparison of non-payload requests
This commit is contained in:
parent
588a7c38ad
commit
f3dc23f578
|
@ -367,12 +367,15 @@ public abstract class BaseRestClientExpectTest<S> {
|
|||
*/
|
||||
public boolean httpRequestsAreEqual(HttpRequest a, HttpRequest b) {
|
||||
try {
|
||||
switch (compareHttpRequestAsType(a)) {
|
||||
case XML: {
|
||||
if (a == null || b == null || a.getPayload() == null || b.getPayload() == null) {
|
||||
if (a == null || b == null) {
|
||||
return false;
|
||||
}
|
||||
if (a.getPayload() == null || b.getPayload() == null) {
|
||||
return Objects.equal(a, b);
|
||||
}
|
||||
|
||||
switch (compareHttpRequestAsType(a)) {
|
||||
case XML: {
|
||||
Diff diff = XMLUnit.compareXML(Strings2.toStringAndClose(a.getPayload().getInput()), Strings2
|
||||
.toStringAndClose(b.getPayload().getInput()));
|
||||
|
||||
|
@ -405,9 +408,6 @@ public abstract class BaseRestClientExpectTest<S> {
|
|||
return diff.identical() && Objects.equal(a.getHeaders(), b.getHeaders());
|
||||
}
|
||||
case JSON: {
|
||||
if (a == null || b == null || a.getPayload() == null || b.getPayload() == null) {
|
||||
return false;
|
||||
}
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement payloadA = parser.parse(Strings2.toStringAndClose(a.getPayload().getInput()));
|
||||
JsonElement payloadB = parser.parse(Strings2.toStringAndClose(b.getPayload().getInput()));
|
||||
|
|
Loading…
Reference in New Issue