RuleStatelessScenarioExecutableBuilder implements RuleScenarioExecutableBuilder { @Override public Map<String, Object> run() { StatelessKieSession statelessKieSession = kieContainer.newStatelessKieSession(sessionName); CoverageAgendaListener coverageAgendaListener = new CoverageAgendaListener(); statelessKieSession.execute(generateCommands(coverageAgendaListener)); Map<String, Object> toReturn = new HashMap<>(); toReturn.put(COVERAGE_LISTENER, coverageAgendaListener); toReturn.put(RULES_AVAILABLE, getAvailableRules(statelessKieSession.getKieBase(), agendaGroup)); return toReturn; } protected  RuleStatelessScenarioExecutableBuilder(KieContainer kieContainer, String sessionName); @Override void addInternalCondition(Class<?> clazz,
                                     Function<Object, ValueWrapper> checkFunction,
                                     ScenarioResult scenarioResult); @Override void setActiveAgendaGroup(String agendaGroup); @Override void setActiveRuleFlowGroup(String ruleFlowGroup); @Override void insert(Object element); @Override Map<String, Object> run();  }
@Test public void testBuilder() { when(kieContainerMock.newStatelessKieSession(anyString())).thenReturn(statelessKieSessionMock); when(statelessKieSessionMock.getKieBase()).thenReturn(kieBaseMock); when(kieBaseMock.getKiePackages()).thenReturn(Collections.emptyList()); String sessionName = "sessionName"; RuleStatelessScenarioExecutableBuilder builder = new RuleStatelessScenarioExecutableBuilder(kieContainerMock, sessionName); Map<String, Object> result = builder.run(); verify(kieContainerMock, times(1)).newStatelessKieSession(eq(sessionName)); assertTrue(result.containsKey(RuleScenarioExecutableBuilder.COVERAGE_LISTENER)); assertTrue(result.containsKey(RuleScenarioExecutableBuilder.RULES_AVAILABLE)); }