@Test public void thenMethodShouldDelegateToRuleThenMethod() throws InvalidClassException { Rule rule = mock(Rule.class); BiConsumer<NameValueReferable, Result> biConsumer = (result, facts) -> { }; RuleAdapter ruleAdapter = new RuleAdapter(new SampleRuleWithResult(), rule); ruleAdapter.addAction(biConsumer); verify(rule, times(1)).addAction(biConsumer); }
@Override @SuppressWarnings("unchecked") public void addAction(Consumer action) { _rule.addAction(action); }
RuleAdapter implements Rule { @Override @SuppressWarnings("unchecked") public void addAction(Consumer action) { _rule.addAction(action); } }
RuleAdapter implements Rule { @Override @SuppressWarnings("unchecked") public void addAction(Consumer action) { _rule.addAction(action); } RuleAdapter(Object pojoRule, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object pojoRule); }
RuleAdapter implements Rule { @Override @SuppressWarnings("unchecked") public void addAction(Consumer action) { _rule.addAction(action); } RuleAdapter(Object pojoRule, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object pojoRule); @Override void addFacts(NameValueReferable... facts); @Override void addFacts(NameValueReferableMap facts); @Override void setFacts(NameValueReferableMap facts); @Override @SuppressWarnings("unchecked") void setCondition(Predicate condition); @Override void setRuleState(RuleState ruleState); @Override @SuppressWarnings("unchecked") void addAction(Consumer action); @Override @SuppressWarnings("unchecked") void addAction(BiConsumer action); @Override void addFactNameFilter(String... factNames); @Override NameValueReferableMap getFacts(); @Override @SuppressWarnings("unchecked") Predicate<NameValueReferableMap> getCondition(); @Override RuleState getRuleState(); @Override @SuppressWarnings("unchecked") List<Object> getActions(); @Override @SuppressWarnings("unchecked") boolean invoke(NameValueReferableMap facts); @Override @SuppressWarnings("unchecked") void setResult(Result result); @Override Optional<Result> getResult(); }
RuleAdapter implements Rule { @Override @SuppressWarnings("unchecked") public void addAction(Consumer action) { _rule.addAction(action); } RuleAdapter(Object pojoRule, Rule rule); @SuppressWarnings("unchecked")  RuleAdapter(Object pojoRule); @Override void addFacts(NameValueReferable... facts); @Override void addFacts(NameValueReferableMap facts); @Override void setFacts(NameValueReferableMap facts); @Override @SuppressWarnings("unchecked") void setCondition(Predicate condition); @Override void setRuleState(RuleState ruleState); @Override @SuppressWarnings("unchecked") void addAction(Consumer action); @Override @SuppressWarnings("unchecked") void addAction(BiConsumer action); @Override void addFactNameFilter(String... factNames); @Override NameValueReferableMap getFacts(); @Override @SuppressWarnings("unchecked") Predicate<NameValueReferableMap> getCondition(); @Override RuleState getRuleState(); @Override @SuppressWarnings("unchecked") List<Object> getActions(); @Override @SuppressWarnings("unchecked") boolean invoke(NameValueReferableMap facts); @Override @SuppressWarnings("unchecked") void setResult(Result result); @Override Optional<Result> getResult();  }