use of org.kie.workbench.common.dmn.client.editors.expressions.types.context.ContextUIModelMapper in project kie-wb-common by kiegroup.
the class AddContextEntryCommandTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.context = new Context();
this.contextEntry = new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("variable"));
}
});
}
};
this.defaultResultContextEntry = new ContextEntry();
this.context.getContextEntry().add(defaultResultContextEntry);
this.uiModel = new BaseGridData();
this.uiModelRow = new BaseGridRow();
this.uiDefaultResultModelRow = new BaseGridRow();
this.uiModel.appendRow(uiDefaultResultModelRow);
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(uiModel).when(gridWidget).getModel();
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
this.uiModel.setCellValue(0, 2, new ExpressionCellValue(Optional.of(undefinedExpressionEditor)));
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(parent).when(undefinedExpressionEditor).getParentInformation();
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt());
this.uiModelMapper = new ContextUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(context), () -> false, () -> expressionEditorDefinitions, listSelector, 0);
}
Aggregations