View | Details | Raw Unified | Return to bug 65794
Collapse All | Expand All

(-)a/src/components/src/main/java/org/apache/jmeter/assertions/JSONPathAssertion.java (-3 / +8 lines)
Lines 30-41 import org.apache.oro.text.regex.Pattern; Link Here
30
import org.slf4j.Logger;
30
import org.slf4j.Logger;
31
import org.slf4j.LoggerFactory;
31
import org.slf4j.LoggerFactory;
32
32
33
import com.jayway.jsonpath.JsonPath;
34
33
import net.minidev.json.JSONArray;
35
import net.minidev.json.JSONArray;
34
import net.minidev.json.JSONObject;
36
import net.minidev.json.JSONObject;
35
import net.minidev.json.JSONValue;
37
import net.minidev.json.JSONValue;
36
38
37
import com.jayway.jsonpath.JsonPath;
38
39
/**
39
/**
40
 * This is main class for JSONPath Assertion which verifies assertion on
40
 * This is main class for JSONPath Assertion which verifies assertion on
41
 * previous sample result using JSON path expression
41
 * previous sample result using JSON path expression
Lines 112-117 public class JSONPathAssertion extends AbstractTestElement implements Serializab Link Here
112
        Object value = JsonPath.read(jsonString, getJsonPath());
112
        Object value = JsonPath.read(jsonString, getJsonPath());
113
113
114
        if (!isJsonValidationBool()) {
114
        if (!isJsonValidationBool()) {
115
            if (value instanceof JSONArray) {
116
                JSONArray arrayValue = (JSONArray) value;
117
                if (arrayValue.isEmpty() && !JsonPath.isPathDefinite(getJsonPath())) {
118
                    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());
119
                }
120
            }
115
            return;
121
            return;
116
        }
122
        }
117
123
118
- 

Return to bug 65794