Upgrade to JSONassert 1.4.0

Closes gh-7846
This commit is contained in:
Phillip Webb 2017-01-05 00:00:07 -08:00
parent 45d5b60f6d
commit fac6b8da47
2 changed files with 23 additions and 7 deletions

View File

@ -121,7 +121,7 @@
<jolokia.version>1.3.5</jolokia.version> <jolokia.version>1.3.5</jolokia.version>
<jooq.version>3.9.0</jooq.version> <jooq.version>3.9.0</jooq.version>
<json.version>20140107</json.version> <json.version>20140107</json.version>
<jsonassert.version>1.3.0</jsonassert.version> <jsonassert.version>1.4.0</jsonassert.version>
<json-path.version>2.2.0</json-path.version> <json-path.version>2.2.0</json-path.version>
<jstl.version>1.2</jstl.version> <jstl.version>1.2</jstl.version>
<jtds.version>1.3.1</jtds.version> <jtds.version>1.3.1</jtds.version>

View File

@ -987,9 +987,17 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
if (this.actual == null) { if (this.actual == null) {
return compareForNull(expectedJson); return compareForNull(expectedJson);
} }
return JSONCompare.compareJSON( try {
(expectedJson == null ? null : expectedJson.toString()), return JSONCompare.compareJSON(
this.actual.toString(), compareMode); (expectedJson == null ? null : expectedJson.toString()),
this.actual.toString(), compareMode);
}
catch (Exception ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
throw new IllegalStateException(ex);
}
} }
private JSONCompareResult compare(CharSequence expectedJson, private JSONCompareResult compare(CharSequence expectedJson,
@ -997,9 +1005,17 @@ public class JsonContentAssert extends AbstractAssert<JsonContentAssert, CharSeq
if (this.actual == null) { if (this.actual == null) {
return compareForNull(expectedJson); return compareForNull(expectedJson);
} }
return JSONCompare.compareJSON( try {
(expectedJson == null ? null : expectedJson.toString()), return JSONCompare.compareJSON(
this.actual.toString(), comparator); (expectedJson == null ? null : expectedJson.toString()),
this.actual.toString(), comparator);
}
catch (Exception ex) {
if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
}
throw new IllegalStateException(ex);
}
} }
private JSONCompareResult compareForNull(CharSequence expectedJson) { private JSONCompareResult compareForNull(CharSequence expectedJson) {