RuleScenarioRunnerHelper extends AbstractRunnerHelper { @Override protected void verifyConditions(ScesimModelDescriptor scesimModelDescriptor, ScenarioRunnerData scenarioRunnerData, ExpressionEvaluatorFactory expressionEvaluatorFactory, Map<String, Object> requestContext) { for (InstanceGiven input : scenarioRunnerData.getGivens()) { FactIdentifier factIdentifier = input.getFactIdentifier(); List<ScenarioExpect> assertionOnFact = scenarioRunnerData.getExpects().stream() .filter(elem -> !elem.isNewFact()) .filter(elem -> Objects.equals(elem.getFactIdentifier(), factIdentifier)).collect(toList()); if (assertionOnFact.isEmpty()) { continue; } getScenarioResultsFromGivenFacts(scesimModelDescriptor, assertionOnFact, input, expressionEvaluatorFactory).forEach(scenarioRunnerData::addResult); } }    }
@Test public void verifyConditionsTest() { List<InstanceGiven> scenario1Inputs = runnerHelper.extractGivenValues(simulation.getScesimModelDescriptor(), scenario1.getUnmodifiableFactMappingValues(), classLoader, expressionEvaluatorFactory); List<ScenarioExpect> scenario1Outputs = runnerHelper.extractExpectedValues(scenario1.getUnmodifiableFactMappingValues()); ScenarioRunnerData scenarioRunnerData1 = new ScenarioRunnerData(); scenario1Inputs.forEach(scenarioRunnerData1::addGiven); scenario1Outputs.forEach(scenarioRunnerData1::addExpect); runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData1, expressionEvaluatorFactory, null); assertEquals(1, scenarioRunnerData1.getResults().size()); List<InstanceGiven> scenario2Inputs = runnerHelper.extractGivenValues(simulation.getScesimModelDescriptor(), scenario2.getUnmodifiableFactMappingValues(), classLoader, expressionEvaluatorFactory); List<ScenarioExpect> scenario2Outputs = runnerHelper.extractExpectedValues(scenario2.getUnmodifiableFactMappingValues()); ScenarioRunnerData scenarioRunnerData2 = new ScenarioRunnerData(); scenario2Inputs.forEach(scenarioRunnerData2::addGiven); scenario2Outputs.forEach(scenarioRunnerData2::addExpect); runnerHelper.verifyConditions(simulation.getScesimModelDescriptor(), scenarioRunnerData2, expressionEvaluatorFactory, null); assertEquals(2, scenarioRunnerData2.getResults().size()); }