PredicateUtil { static public Boolean binaryXor(Boolean left, Boolean right){ if(left == null || right == null){ return null; } else { return Boolean.valueOf(left.booleanValue() ^ right.booleanValue()); } } private  PredicateUtil(); static Predicate ensurePredicate(E hasPredicate); static Boolean evaluatePredicateContainer(E hasPredicate, EvaluationContext context); static Boolean evaluate(Predicate predicate, EvaluationContext context); static Boolean evaluateSimplePredicate(SimplePredicate simplePredicate, EvaluationContext context); static Boolean evaluateSimpleSetPredicate(SimpleSetPredicate simpleSetPredicate, EvaluationContext context); static Boolean evaluateCompoundPredicate(CompoundPredicate compoundPredicate, EvaluationContext context); static CompoundPredicateResult evaluateCompoundPredicateInternal(CompoundPredicate compoundPredicate, EvaluationContext context); static Boolean evaluateTrue(True truePredicate); static Boolean evaluateFalse(False falsePredicate); static Boolean evaluateJavaPredicate(JavaPredicate javaPredicate, EvaluationContext context); static Boolean binaryAnd(Boolean left, Boolean right); static Boolean binaryOr(Boolean left, Boolean right); static Boolean binaryXor(Boolean left, Boolean right);  }
@Test public void binaryXor(){ assertEquals(Boolean.FALSE, PredicateUtil.binaryXor(Boolean.TRUE, Boolean.TRUE)); assertEquals(Boolean.TRUE, PredicateUtil.binaryXor(Boolean.TRUE, Boolean.FALSE)); assertEquals(null, PredicateUtil.binaryXor(Boolean.TRUE, null)); assertEquals(Boolean.TRUE, PredicateUtil.binaryXor(Boolean.FALSE, Boolean.TRUE)); assertEquals(Boolean.FALSE, PredicateUtil.binaryXor(Boolean.FALSE, Boolean.FALSE)); assertEquals(null, PredicateUtil.binaryXor(Boolean.FALSE, null)); assertEquals(null, PredicateUtil.binaryXor(null, Boolean.TRUE)); assertEquals(null, PredicateUtil.binaryXor(null, Boolean.FALSE)); assertEquals(null, PredicateUtil.binaryXor(null, null)); }