AndExpression extends BooleanExpression { @Override public IJsonNode evaluate(final IJsonNode node, final IJsonNode target, final EvaluationContext context) { for (final EvaluationExpression booleanExpression : this.expressions) if (booleanExpression.evaluate(node, null, context) == BooleanNode.FALSE) return BooleanNode.FALSE; return BooleanNode.TRUE; } AndExpression(final BooleanExpression... expressions);  AndExpression(final List<? extends BooleanExpression> expressions); @Override boolean equals(final Object obj); @Override IJsonNode evaluate(final IJsonNode node, final IJsonNode target, final EvaluationContext context); List<BooleanExpression> getExpressions(); @Override int hashCode(); @Override void toString(final StringBuilder builder); @Override EvaluationExpression transformRecursively(final TransformFunction function); static AndExpression valueOf(final BooleanExpression expression); static AndExpression valueOf(final List<? extends EvaluationExpression> childConditions);  }
@Test public void shouldBeTrueIfAllExprAreTrue() { final IJsonNode result = new AndExpression(TRUE, BooleanExpression.ensureBooleanExpression(EvaluationExpression.VALUE), TRUE). evaluate(BooleanNode.TRUE, null, this.context); Assert.assertEquals(BooleanNode.TRUE, result); }
@Test public void shouldBeFalseIfOneExprIsFalse() { final IJsonNode result = new AndExpression(TRUE, BooleanExpression.ensureBooleanExpression(EvaluationExpression.VALUE), TRUE). evaluate(BooleanNode.FALSE, null, this.context); Assert.assertEquals(BooleanNode.FALSE, result); }