Browse Source

corrected way to specify cause of AssertionError

pull/142/head
Alexey Makeyev 9 years ago
parent
commit
4642a09ae6
  1. 4
      json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java

4
json-path-assert/src/main/java/com/jayway/jsonassert/impl/JsonAsserterImpl.java

@ -33,7 +33,9 @@ public class JsonAsserterImpl implements JsonAsserter {
try { try {
obj = JsonPath.<T>read(jsonObject, path); obj = JsonPath.<T>read(jsonObject, path);
} catch (Exception e) { } catch (Exception e) {
throw new AssertionError(String.format("Error reading JSON path [%s]: %s", path, e)); final AssertionError assertionError = new AssertionError(String.format("Error reading JSON path [%s]", path));
assertionError.initCause(e);
throw assertionError;
} }
if (!matcher.matches(obj)) { if (!matcher.matches(obj)) {

Loading…
Cancel
Save