You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by GitBox <gi...@apache.org> on 2022/10/29 09:49:06 UTC
[GitHub] [jmeter] vlsi commented on a diff in pull request #5717: Add jsonpath string to jsonpath assertion error message
vlsi commented on code in PR #5717:
URL: https://github.com/apache/jmeter/pull/5717#discussion_r1008671507
##########
src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java:
##########
@@ -137,15 +137,15 @@ private void doAssert(String jsonString) {
}
if (isExpectNull()) {
- throw new IllegalStateException(String.format("Value expected to be null, but found '%s'", value));
+ throw new IllegalStateException(String.format("Value in json path '%s' expected to be null, but found '%s'", getJsonPath(), value));
Review Comment:
Should `value` be `objectToString(value)` like below?
##########
src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java:
##########
@@ -118,8 +118,8 @@ private void doAssert(String jsonString) {
if (value instanceof JSONArray) {
JSONArray arrayValue = (JSONArray) value;
if (arrayValue.isEmpty() && !JsonPath.isPathDefinite(getJsonPath())) {
- throw new IllegalStateException("JSONPath is indefinite and the extracted Value is an empty Array." +
- " Please use an assertion value, to be sure to get a correct result. " + getExpectedValue());
+ throw new IllegalStateException(String.format("JSONPath '%s' is indefinite and the extracted Value is an empty Array." +
+ " Please use an assertion value, to be sure to get a correct result. '%s'", getJsonPath(), getExpectedValue()));
Review Comment:
```suggestion
" Please use an assertion value, to be sure to get a correct result. Expected value was '%s'", getJsonPath(), getExpectedValue()));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@jmeter.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org