### Question:
Rules implements Iterable<Rule> { public void unregister(Object... rules) { Objects.requireNonNull(rules); for (Object rule : rules) { Objects.requireNonNull(rule); this.rules.remove(RuleProxy.asRule(rule)); } } Rules(Set<Rule> rules);  Rules(Rule... rules);  Rules(Object... rules); void register(Object... rules); void unregister(Object... rules); void unregister(final String ruleName); boolean isEmpty(); void clear(); int size(); @Override Iterator<Rule> iterator();  }### Answer:
@Test public void unregister() { DummyRule rule = new DummyRule(); rules.register(rule); rules.unregister(rule); assertThat(rules).isEmpty(); }
@Test public void unregisterByName() { Rule r1 = new BasicRule("rule1"); Rule r2 = new BasicRule("rule2"); Set<Rule> ruleSet = new HashSet<>(); ruleSet.add(r1); ruleSet.add(r2); rules = new Rules(ruleSet); rules.unregister("rule2"); assertThat(rules).hasSize(1).containsExactly(r1); }
@Test public void unregisterByNameNonExistingRule() { Rule r1 = new BasicRule("rule1"); Set<Rule> ruleSet = new HashSet<>(); ruleSet.add(r1); rules = new Rules(ruleSet); rules.unregister("rule2"); assertThat(rules).hasSize(1).containsExactly(r1); }