我需要测试谓词对象是否与各种表达式语言的交换相匹配。我需要知道我需要设置什么交换值来交换来验证谓词。
public void test() {
String expression="//orders/value>10"';
CamelContext context = new DefaultCamelContext();
Predicate predicate=new JXpathExpression(expression,boolean.class);
Exchange exchange = new DefaultExchange(context);
Message in = exchange.getIn();
in.setBody(""); // how i need to set the message in exchange in order to evaluate it against predicate
exchange.setIn(in);
boolean check=predicate.matches(exchange);
}
对于 JXPath,谓词对象JXpath[//orders/value>10]
在我使用predicate.toString()
.
如何设置交换以便可以验证此表达式?