@Test @SuppressWarnings("unchecked") public void auditableRulesRegisterThemselvesWithAuditors() { Rule<String, String> rule = Mockito.mock(Rule.class); Auditable auditable = new AuditableRule<String, String>(rule); Auditor auditor = Mockito.mock(Auditor.class); auditable.setAuditor(auditor); Mockito.verify(auditor, Mockito.times(1)).registerRule(auditable); }
@Override public void setAuditor(Auditor auditor) { _auditor = auditor; _auditor.registerRule(this); }
AuditableRule implements Rule<T, U>, Auditable { @Override public void setAuditor(Auditor auditor) { _auditor = auditor; _auditor.registerRule(this); } }
AuditableRule implements Rule<T, U>, Auditable { @Override public void setAuditor(Auditor auditor) { _auditor = auditor; _auditor.registerRule(this); } AuditableRule(Rule<T, U> rule);  AuditableRule(Rule<T, U> rule, String name); }
AuditableRule implements Rule<T, U>, Auditable { @Override public void setAuditor(Auditor auditor) { _auditor = auditor; _auditor.registerRule(this); } AuditableRule(Rule<T, U> rule);  AuditableRule(Rule<T, U> rule, String name); @Override void addFacts(NameValueReferable... facts); @Override void addFacts(NameValueReferableMap facts); @Override void setFacts(NameValueReferableMap facts); @Override void setCondition(Predicate<NameValueReferableTypeConvertibleMap<T>> condition); @Override void setRuleState(RuleState ruleState); @Override void addAction(Consumer<NameValueReferableTypeConvertibleMap<T>> action); @Override void addAction(BiConsumer<NameValueReferableTypeConvertibleMap<T>, Result<U>> action); @Override void addFactNameFilter(String... factNames); @Override NameValueReferableMap getFacts(); @Override Predicate<NameValueReferableTypeConvertibleMap<T>> getCondition(); @Override RuleState getRuleState(); @Override List<Object> getActions(); @Override boolean invoke(NameValueReferableMap facts); @Override void setResult(Result<U> result); @Override Optional<Result<U>> getResult(); @Override void setAuditor(Auditor auditor); @Override String getName(); }
AuditableRule implements Rule<T, U>, Auditable { @Override public void setAuditor(Auditor auditor) { _auditor = auditor; _auditor.registerRule(this); } AuditableRule(Rule<T, U> rule);  AuditableRule(Rule<T, U> rule, String name); @Override void addFacts(NameValueReferable... facts); @Override void addFacts(NameValueReferableMap facts); @Override void setFacts(NameValueReferableMap facts); @Override void setCondition(Predicate<NameValueReferableTypeConvertibleMap<T>> condition); @Override void setRuleState(RuleState ruleState); @Override void addAction(Consumer<NameValueReferableTypeConvertibleMap<T>> action); @Override void addAction(BiConsumer<NameValueReferableTypeConvertibleMap<T>, Result<U>> action); @Override void addFactNameFilter(String... factNames); @Override NameValueReferableMap getFacts(); @Override Predicate<NameValueReferableTypeConvertibleMap<T>> getCondition(); @Override RuleState getRuleState(); @Override List<Object> getActions(); @Override boolean invoke(NameValueReferableMap facts); @Override void setResult(Result<U> result); @Override Optional<Result<U>> getResult(); @Override void setAuditor(Auditor auditor); @Override String getName();  }