### Question:
UndefinedExpressionUIModelMapper extends BaseUIModelMapper<Expression> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { cell.get().ifPresent(v -> { final ExpressionCellValue ecv = (ExpressionCellValue) v; ecv.getValue().ifPresent(beg -> { hasExpression.setExpression(beg.getExpression().get().orElse(null)); beg.getExpression().get().ifPresent(e -> e.setParent(hasExpression.asDMNModelInstrumentedBase())); }); }); } UndefinedExpressionUIModelMapper(final Supplier<GridData> uiModel,
                                            final Supplier<Optional<Expression>> dmnModel,
                                            final ListSelectorView.Presenter listSelector,
                                            final TranslationService translationService,
                                            final HasExpression hasExpression); @Override void fromDMNModel(final int rowIndex,
                             final int columnIndex); @Override void toDMNModel(final int rowIndex,
                           final int columnIndex,
                           final Supplier<Optional<GridCellValue<?>>> cell);  }### Answer:
@Test public void testToDMNModelNoEditor() { when(editor.getExpression()).thenReturn(Optional::empty); mapper.toDMNModel(0, 0, cellValueSupplier); verify(hasExpression).setExpression(eq(null)); }
@Test public void testToDMNModelWithEditor() { when(editor.getExpression()).thenReturn(() -> Optional.of(expression)); mapper.toDMNModel(0, 0, cellValueSupplier); verify(hasExpression).setExpression(eq(expression)); verify(expression).setParent(eq(hasExpressionDMNModelInstrumentedBase)); }