Source:
<code>public void setup() { uiModel = new BaseGridData(); uiModel.appendRow(new DMNGridRow()); uiModel.appendColumn(uiExpressionColumn); doReturn(0).when(uiExpressionColumn).getIndex(); doReturn(MINIMUM_COLUMN_WIDTH).when(uiExpressionColumn).getMinimumWidth(); parent = new GridCellTuple(0, 0, expressionContainerGrid); final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions(); expressionEditorDefinitions.add(literalExpressionEditorDefinition); expressionEditorDefinitions.add(undefinedExpressionEditorDefinition); doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get(); doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass(); doReturn(true).when(literalExpressionEditor).isCacheable(); doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression(); doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt()); 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), any(Optional.class), anyInt()); expressionGridCache = new ExpressionGridCacheImpl(); mapper = new ExpressionContainerUIModelMapper(parent, () -> uiModel, () -> Optional.ofNullable(expression), () -> NODE_UUID, () -> hasExpression, () -> Optional.of(hasName), expressionEditorDefinitionsSupplier, <START> () -> expressionGridCache, <END> listSelector); }</code><technical_language>I improve coverage of cache usage in mapper class: manstis/kie-wb-common#30</technical_language>

Target:
public void setup() { uiModel = new BaseGridData(); uiModel.appendRow(new DMNGridRow()); uiModel.appendColumn(uiExpressionColumn); doReturn(0).when(uiExpressionColumn).getIndex(); doReturn(MINIMUM_COLUMN_WIDTH).when(uiExpressionColumn).getMinimumWidth(); parent = new GridCellTuple(0, 0, expressionContainerGrid); final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions(); expressionEditorDefinitions.add(literalExpressionEditorDefinition); expressionEditorDefinitions.add(undefinedExpressionEditorDefinition); doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get(); doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass(); doReturn(true).when(literalExpressionEditor).isCacheable(); doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression(); doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt()); 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), any(Optional.class), anyInt()); expressionGridCache = spy(new ExpressionGridCacheImpl()); mapper = new ExpressionContainerUIModelMapper(parent, () -> uiModel, () -> Optional.ofNullable(expression), () -> NODE_UUID, () -> hasExpression, () -> Optional.of(hasName), expressionEditorDefinitionsSupplier, () -> expressionGridCache, listSelector); }