### Question:
OrRule implements Rule { @Override public boolean ruleMatches(Product product) throws IllegalArgumentException { for(Rule rule : rules) { if(rule.ruleMatches(product)) { return true; } } return false; } OrRule(Rule ... rules); @Override boolean ruleMatches(Product product);  }### Answer:
@Test public void testRuleMatches() { Rule rule = new OrRule( new AlwaysTrueRule(), new AlwaysTrueRule()); Assert.assertTrue(rule.ruleMatches(null)); rule = new OrRule( new AlwaysTrueRule(), new NotRule( new AlwaysTrueRule())); Assert.assertTrue(rule.ruleMatches(null)); rule = new OrRule( new NotRule( new AlwaysTrueRule()), new AlwaysTrueRule()); Assert.assertTrue(rule.ruleMatches(null)); rule = new OrRule( new NotRule( new AlwaysTrueRule()), new NotRule( new AlwaysTrueRule())); Assert.assertFalse(rule.ruleMatches(null)); }