use of org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.expressionGridCache = new ExpressionGridCacheImpl();
this.gridLayer = spy(new DMNGridLayer());
this.grid = new ExpressionContainerGrid(gridLayer, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, canvasCommandFactory, expressionEditorDefinitionsSupplier, () -> expressionGridCache, onHasExpressionChanged, onHasNameChanged, refreshFormPropertiesEvent, domainObjectSelectionEvent) {
@Override
public CellSelectionManager getCellSelectionManager() {
return cellSelectionManager;
}
};
this.gridLayer.add(grid);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
when(expressionEditorDefinitionsSupplier.get()).thenReturn(expressionEditorDefinitions);
when(literalExpressionEditor.isCacheable()).thenReturn(true);
when(literalExpressionEditor.getParentInformation()).thenReturn(parent);
when(literalExpressionEditor.getModel()).thenReturn(new BaseGridData());
when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(literalExpression));
when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
when(undefinedExpressionEditor.getParentInformation()).thenReturn(parent);
when(undefinedExpressionEditor.getModel()).thenReturn(new BaseGridData());
when(undefinedExpressionEditorDefinition.getModelClass()).thenReturn(Optional.empty());
when(undefinedExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(undefinedExpressionEditor));
when(sessionManager.getCurrentSession()).thenReturn(session);
when(session.getCanvasHandler()).thenReturn(canvasHandler);
when(canvasHandler.getGraphExecutionContext()).thenReturn(graphExecutionContext);
doReturn(mock(Bounds.class)).when(gridLayer).getVisibleBounds();
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(Collections.singletonList(node));
when(parent.getGridWidget()).thenReturn(grid);
when(parent.getRowIndex()).thenReturn(0);
when(parent.getColumnIndex()).thenReturn(0);
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(Mockito.<String>any());
}
Aggregations