@Override
    public boolean matches(Exchange exchange) {
        final Object value = evaluate(exchange, Object.class);

        if (value instanceof BooleanNode) {
            return ((BooleanNode) value).asBoolean();
        }
        if (value instanceof Collection) {
            return !((Collection<?>) value).isEmpty();
        }

        return false;
    }
@Test
    public void matches() throws Exception {
        try (CamelContext context = new DefaultCamelContext()) {
            ObjectNode node = MAPPER.createObjectNode();
            node.put("foo", "bar");
            node.put("baz", "bak");

            Exchange exchange = new DefaultExchange(context);
            exchange.getMessage().setBody(node);
            exchange.getMessage().setHeader("CommitterName", "Andrea");

            assertThat(jq(context, "has(\"baz\")").matches(exchange)).isTrue();
            assertThat(jq(context, "has(\"bar\")").matches(exchange)).isFalse();
            assertThat(jq(context, "header(\"CommitterName\") == \"Andrea\"").matches(exchange)).isTrue();
            assertThat(jq(context, "header(\"CommitterName\") != \"Andrea\"").matches(exchange)).isFalse();
        }
    }