Consistent use of JDK 7 AssertionError with root cause
Issue: SPR-13188
This commit is contained in:
parent
655097a343
commit
728a548199
|
|
@ -237,22 +237,22 @@ public class JsonPathExpectationsHelper {
|
|||
}
|
||||
|
||||
private Object evaluateJsonPath(String content) {
|
||||
String message = "No value at JSON path \"" + this.expression + "\", exception: ";
|
||||
String message = "No value at JSON path \"" + this.expression + "\"";
|
||||
try {
|
||||
return this.jsonPath.read(content);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new AssertionError(message + ex.getMessage());
|
||||
throw new AssertionError(message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private Object evaluateJsonPath(String content, Class<?> targetType) {
|
||||
String message = "No value at JSON path \"" + this.expression + "\", exception: ";
|
||||
String message = "No value at JSON path \"" + this.expression + "\"";
|
||||
try {
|
||||
return JsonPath.parse(content).read(this.expression, targetType);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new AssertionError(message + ex.getMessage());
|
||||
throw new AssertionError(message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class ContentRequestMatchers {
|
|||
matchInternal(mockRequest);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new AssertionError("Failed to parse expected or actual XML request content: " + ex.getMessage());
|
||||
throw new AssertionError("Failed to parse expected or actual XML request content", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ public class JsonPathRequestMatchers {
|
|||
matchInternal(mockRequest);
|
||||
}
|
||||
catch (ParseException ex) {
|
||||
throw new AssertionError("Failed to parse JSON request content: " + ex.getMessage());
|
||||
throw new AssertionError("Failed to parse JSON request content", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ public class XpathRequestMatchers {
|
|||
matchInternal(mockRequest);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
throw new AssertionError("Failed to parse XML request content: " + ex.getMessage());
|
||||
throw new AssertionError("Failed to parse XML request content", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -258,9 +258,8 @@ public class JsonPathResultMatchers {
|
|||
MatcherAssert.assertThat(reason, content, StringStartsWith.startsWith(this.prefix));
|
||||
return content.substring(this.prefix.length());
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException oobe) {
|
||||
throw new AssertionError(
|
||||
"JSON prefix \"" + this.prefix + "\" not found, exception: " + oobe.getMessage());
|
||||
catch (StringIndexOutOfBoundsException ex) {
|
||||
throw new AssertionError("JSON prefix \"" + this.prefix + "\" not found", ex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue