### Question:
XorRule extends AbstractRule { @Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { final boolean satisfied = rule1.isSatisfied(index, tradingRecord) ^ rule2.isSatisfied(index, tradingRecord); traceIsSatisfied(index, satisfied); return satisfied; } XorRule(Rule rule1, Rule rule2); @Override boolean isSatisfied(int index, TradingRecord tradingRecord);  }### Answer:
@Test public void isSatisfied() { assertTrue(satisfiedRule.xor(BooleanRule.FALSE).isSatisfied(0)); assertTrue(BooleanRule.FALSE.xor(satisfiedRule).isSatisfied(0)); assertFalse(unsatisfiedRule.xor(BooleanRule.FALSE).isSatisfied(0)); assertFalse(BooleanRule.FALSE.xor(unsatisfiedRule).isSatisfied(0)); assertFalse(satisfiedRule.xor(BooleanRule.TRUE).isSatisfied(10)); assertFalse(BooleanRule.TRUE.xor(satisfiedRule).isSatisfied(10)); assertTrue(unsatisfiedRule.xor(BooleanRule.TRUE).isSatisfied(10)); assertTrue(BooleanRule.TRUE.xor(unsatisfiedRule).isSatisfied(10)); }