|
|
|
@ -50,7 +50,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
@Override |
|
|
|
|
boolean eval(Object expected, Object actual, PredicateContext ctx) { |
|
|
|
|
boolean res = (0 == safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -58,7 +58,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
@Override |
|
|
|
|
boolean eval(Object expected, Object actual, PredicateContext ctx) { |
|
|
|
|
boolean res = (0 != safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -69,7 +69,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean res = (0 > safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -80,7 +80,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean res = (0 >= safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -91,7 +91,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean res = (0 < safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -102,7 +102,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
boolean res = (0 <= safeCompare(expected, actual)); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected, res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -117,7 +117,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), join(", ", exps), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), join(", ", exps), res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -126,7 +126,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
boolean eval(Object expected, Object actual, PredicateContext ctx) { |
|
|
|
|
Collection nexps = (Collection) expected; |
|
|
|
|
boolean res = !nexps.contains(actual); |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), join(", ", nexps), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), join(", ", nexps), res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -149,10 +149,10 @@ public class Criteria implements Predicate {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", join(", ", ctx.configuration().jsonProvider().toIterable(actual)), name(), join(", ", exps), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", join(", ", ctx.configuration().jsonProvider().toIterable(actual)), name(), join(", ", exps), res); |
|
|
|
|
} else { |
|
|
|
|
res = false; |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", "<NOT AN ARRAY>", name(), join(", ", exps), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", "<NOT AN ARRAY>", name(), join(", ", exps), res); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
@ -165,14 +165,14 @@ public class Criteria implements Predicate {
|
|
|
|
|
if (ctx.configuration().jsonProvider().isArray(actual)) { |
|
|
|
|
int length = ctx.configuration().jsonProvider().length(actual); |
|
|
|
|
res = (length == size); |
|
|
|
|
logger.debug("Array with size {} {} {} => {}", length, name(), size, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("Array with size {} {} {} => {}", length, name(), size, res); |
|
|
|
|
} else if (actual instanceof String) { |
|
|
|
|
int length = ((String) actual).length(); |
|
|
|
|
res = length == size; |
|
|
|
|
logger.debug("String with length {} {} {} => {}", length, name(), size, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("String with length {} {} {} => {}", length, name(), size, res); |
|
|
|
|
} else { |
|
|
|
|
res = false; |
|
|
|
|
logger.debug("{} {} {} => {}", actual == null ? "null" : actual.getClass().getName(), name(), size, res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("{} {} {} => {}", actual == null ? "null" : actual.getClass().getName(), name(), size, res); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
@ -201,7 +201,7 @@ public class Criteria implements Predicate {
|
|
|
|
|
if (actual != null && actual instanceof String) { |
|
|
|
|
res = pattern.matcher(actual.toString()).matches(); |
|
|
|
|
} |
|
|
|
|
logger.debug("[{}] {} [{}] => {}", actual, name(), expected.toString(), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("[{}] {} [{}] => {}", actual, name(), expected.toString(), res); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -221,11 +221,11 @@ public class Criteria implements Predicate {
|
|
|
|
|
if (ctx.configuration().jsonProvider().isArray(actual)) { |
|
|
|
|
int len = ctx.configuration().jsonProvider().length(actual); |
|
|
|
|
res = (0 != len); |
|
|
|
|
logger.debug("array length = {} {} => {}", len, name(), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("array length = {} {} => {}", len, name(), res); |
|
|
|
|
} else if (actual instanceof String) { |
|
|
|
|
int len = ((String) actual).length(); |
|
|
|
|
res = (0 != len); |
|
|
|
|
logger.debug("string length = {} {} => {}", len, name(), res); |
|
|
|
|
if(logger.isDebugEnabled()) logger.debug("string length = {} {} => {}", len, name(), res); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|