@Override
    public RuleConfig newRuleConfig() {
        return new RuleConfigImpl();
    }
@Test
    public void logicalAddByElement() {
        // DROOLS-7583
        LogicalAddByElementTestUnit unit = new LogicalAddByElementTestUnit();

        ArrayList<String> eventsRecorded = new ArrayList<>();

        RuleConfig ruleConfig = RuleUnitProvider.get().newRuleConfig();
        ruleConfig.getRuleRuntimeListeners().add(new RuleRuntimeEventListener() {
            @Override
            public void objectInserted(ObjectInsertedEvent event) {
                String byRuleName = Optional.ofNullable(event.getRule())
                  .map(rule -> " by " + rule.getName())
                  .orElse("");
                eventsRecorded.add(event.getObject() + " inserted" + byRuleName);
            }

            @Override
            public void objectUpdated(ObjectUpdatedEvent event) {
            }

            @Override
            public void objectDeleted(ObjectDeletedEvent event) {
                String byRuleName = Optional.ofNullable(event.getRule())
                  .map(rule -> " by " + rule.getName())
                  .orElse("");
                eventsRecorded.add(event.getOldObject() + " deleted" + byRuleName);
            }
        });

        try ( RuleUnitInstance<LogicalAddByElementTestUnit> unitInstance = RuleUnitProvider.get().createRuleUnitInstance(unit, ruleConfig) ) {

            DataHandle handleToStringWithLength3 = unit.getStrings().add("abc");
            unit.getStrings().add("len4");

            assertThat(unitInstance.fire()).isEqualTo(4);

            assertThat(eventsRecorded).containsExactly(
              "abc inserted",
              "len4 inserted",
              "3 inserted by R1",
              "4 inserted by R1");
            assertThat(unit.getResults()).containsExactly("3 exists", "4 exists");

            eventsRecorded.clear();
            unit.getResults().clear();

            unit.getStrings().remove(handleToStringWithLength3);
            assertThat(unitInstance.fire()).isEqualTo(0);

            assertThat(eventsRecorded).doesNotContain("4 deleted");
            assertThat(eventsRecorded).containsExactly("abc deleted", "3 deleted");
        }
    }