Consider empty arrays as existent in JsonPath assertions
Prior to this commit, a JsonPath assertion that a path expression evaluated to an array in JsonPathExpectationsHelper (and therefore indirectly in JsonPathResultMatchers in Spring MVC Test) would incorrectly fail if the array was present in the JSON content but empty. This commit fixes this issue by removing the "not empty" check for arrays and lists. Issue: SPR-13320
This commit is contained in:
@@ -238,9 +238,6 @@ public class JsonPathExpectationsHelper {
|
||||
Object value = evaluateJsonPath(content);
|
||||
String reason = "No value for JSON path \"" + this.expression + "\"";
|
||||
assertTrue(reason, value != null);
|
||||
if (List.class.isInstance(value)) {
|
||||
assertTrue(reason, !((List<?>) value).isEmpty());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user