Browse Source

Criteria improvement.

pull/55/head
Kalle Stenflo 10 years ago
parent
commit
34ef58cba9
  1. 6
      json-path/src/main/java/com/jayway/jsonpath/Criteria.java

6
json-path/src/main/java/com/jayway/jsonpath/Criteria.java

@ -281,17 +281,13 @@ public class Criteria implements Predicate {
if (CriteriaType.EXISTS == criteriaType) {
boolean exists = ((Boolean) expected);
try {
Configuration c = ctx.configuration();
if(c.containsOption(Option.ALWAYS_RETURN_LIST) || c.containsOption(Option.SUPPRESS_EXCEPTIONS)){
c = c.options();
}
Configuration c = Configuration.builder().jsonProvider(ctx.configuration().getProvider()).options().build();
path.evaluate(ctx.target(), c).getValue();
return exists;
} catch (PathNotFoundException e) {
return !exists;
}
} else {
try {
final Object actual = path.evaluate(ctx.target(), ctx.configuration()).getValue();
return criteriaType.eval(expected, actual, ctx.configuration());

Loading…
Cancel
Save