AndExpression extends BooleanExpression { @Override public BooleanNode evaluate(final IJsonNode node) { for (final EvaluationExpression booleanExpression : this.expressions) if (booleanExpression.evaluate(node) == BooleanNode.FALSE) return BooleanNode.FALSE; return BooleanNode.TRUE; } AndExpression();  AndExpression(final BooleanExpression... expressions);  AndExpression(final List<? extends BooleanExpression> expressions); AndExpression addExpression(final BooleanExpression expression); @Override void appendAsString(final Appendable appendable); @Override boolean equals(final Object obj); @Override BooleanNode evaluate(final IJsonNode node); List<BooleanExpression> getExpressions(); @Override int hashCode(); @Override ChildIterator iterator(); static AndExpression valueOf(final BooleanExpression expression); static AndExpression valueOf(final List<? extends EvaluationExpression> childConditions);  }
@Test public void shouldBeFalseIfOneExprIsFalse() { final IJsonNode result = new AndExpression(TRUE, BooleanExpression.ensureBooleanExpression(EvaluationExpression.VALUE), TRUE). evaluate(BooleanNode.FALSE); Assert.assertEquals(BooleanNode.FALSE, result); }
@Test public void shouldBeTrueIfAllExprAreTrue() { final IJsonNode result = new AndExpression(TRUE, BooleanExpression.ensureBooleanExpression(EvaluationExpression.VALUE), TRUE). evaluate(BooleanNode.TRUE); Assert.assertEquals(BooleanNode.TRUE, result); }