### Question:
ListUIModelMapper extends BaseUIModelMapper<List> { @Override public void toDMNModel(final int rowIndex, final int columnIndex, final Supplier<Optional<GridCellValue<?>>> cell) { dmnModel.get().ifPresent(list -> { final ListUIModelMapperHelper.ListSection section = ListUIModelMapperHelper.getSection(columnIndex); switch (section) { case ROW_INDEX: break; case EXPRESSION: cell.get().ifPresent(v -> { final ExpressionCellValue ecv = (ExpressionCellValue) v; ecv.getValue().ifPresent(beg -> { list.getExpression().get(rowIndex).setExpression(beg.getExpression().get().orElse(null)); }); }); } }); } ListUIModelMapper(final GridWidget gridWidget,
                             final Supplier<GridData> uiModel,
                             final Supplier<Optional<List>> dmnModel,
                             final Supplier<Boolean> isOnlyVisualChangeAllowedSupplier,
                             final Supplier<ExpressionEditorDefinitions> expressionEditorDefinitionsSupplier,
                             final ListSelectorView.Presenter listSelector,
                             final int nesting); @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 @SuppressWarnings("unchecked") public void testToDMNModelExpressionNull() { setup(new LiteralExpression(), false); cellValueSupplier = () -> Optional.of(new ExpressionCellValue(Optional.of(undefinedExpressionEditor))); mapper.toDMNModel(0, EXPRESSION_COLUMN_INDEX, cellValueSupplier); assertNull(list.getExpression().get(0).getExpression()); }
@Test public void testToDMNModelExpressionNonNull() { setup(null, false); cellValueSupplier = () -> Optional.of(new ExpressionCellValue(Optional.of(literalExpressionEditor))); mapper.toDMNModel(0, EXPRESSION_COLUMN_INDEX, cellValueSupplier); assertEquals(literalExpression, list.getExpression().get(0).getExpression()); }