public void setDescription(String name) { addOrUpdateMappingValue(FactIdentifier.DESCRIPTION, ExpressionIdentifier.DESCRIPTION, name); }
public void setDescription(String name) { addOrUpdateMappingValue(FactIdentifier.DESCRIPTION, ExpressionIdentifier.DESCRIPTION, name); }
@Test public void extractExpectedValuesTest() { List<ScenarioExpect> scenario1Outputs = runnerHelper.extractExpectedValues(scenario1.getUnmodifiableFactMappingValues()); assertEquals(1, scenario1Outputs.size()); scenario2.addOrUpdateMappingValue(FactIdentifier.create("TEST", String.class.getCanonicalName()), ExpressionIdentifier.create("TEST", FactMappingType.EXPECT), "TEST"); List<ScenarioExpect> scenario2Outputs = runnerHelper.extractExpectedValues(scenario2.getUnmodifiableFactMappingValues()); assertEquals(3, scenario2Outputs.size()); assertEquals(1, scenario2Outputs.stream().filter(ScenarioExpect::isNewFact).count()); }
/** * This method <i>set</i> a cell value to the grid <b>and</b> to the underlying model * @param rowIndex * @param columnIndex * @param cellSupplier */ @Override public Range setCell(int rowIndex, int columnIndex, Supplier<GridCell<?>> cellSupplier) { checkSimulation(); Range toReturn = super.setCell(rowIndex, columnIndex, cellSupplier); try { Optional<?> optionalValue = getCellValue(getCell(rowIndex, columnIndex)); Object rawValue = optionalValue.orElse(null); String cellValue = (rawValue instanceof String) ? (String) rawValue : null; Scenario scenarioByIndex = simulation.getScenarioByIndex(rowIndex); FactMapping factMappingByIndex = simulation.getSimulationDescriptor().getFactMappingByIndex(columnIndex); FactIdentifier factIdentifier = factMappingByIndex.getFactIdentifier(); ExpressionIdentifier expressionIdentifier = factMappingByIndex.getExpressionIdentifier(); scenarioByIndex.addOrUpdateMappingValue(factIdentifier, expressionIdentifier, cellValue); } catch (Throwable t) { toReturn = super.deleteCell(rowIndex, columnIndex); eventBus.fireEvent(new ScenarioGridReloadEvent()); } return toReturn; }
@Test public void addOrUpdateMappingValue() { Object value1 = "Test 1"; Object value2 = "Test 2"; FactMappingValue factMappingValue = scenario.addMappingValue(factIdentifier, expressionIdentifier, value1); assertEquals(factMappingValue.getRawValue(), value1); FactMappingValue factMappingValue1 = scenario.addOrUpdateMappingValue(factIdentifier, expressionIdentifier, value2); assertEquals(factMappingValue, factMappingValue1); assertEquals(factMappingValue1.getRawValue(), value2); }
@Test public void addOrUpdateMappingValue() { Object value1 = "Test 1"; Object value2 = "Test 2"; FactMappingValue factMappingValue = scenario.addMappingValue(factIdentifier, expressionIdentifier, value1); assertEquals(factMappingValue.getRawValue(), value1); FactMappingValue factMappingValue1 = scenario.addOrUpdateMappingValue(factIdentifier, expressionIdentifier, value2); assertEquals(factMappingValue, factMappingValue1); assertEquals(factMappingValue1.getRawValue(), value2); }