### Question:
GridCellTuple implements RequiresResize { public void proposeContainingColumnWidth(final double proposedWidth, final Function<BaseExpressionGrid, Double> requiredWidthSupplier) { final GridColumn<?> parentColumn = gridWidget.getModel().getColumns().get(columnIndex); final double requiredWidth = Math.max(proposedWidth, getRequiredParentColumnWidth(proposedWidth, requiredWidthSupplier)); parentColumn.setWidth(requiredWidth); } GridCellTuple(final int rowIndex,
                         final int columnIndex,
                         final GridWidget gridWidget); int getRowIndex(); void setRowIndex(final int rowIndex); int getColumnIndex(); void setColumnIndex(final int columnIndex); GridWidget getGridWidget(); void proposeContainingColumnWidth(final double proposedWidth,
                                             final Function<BaseExpressionGrid, Double> requiredWidthSupplier); @Override void onResize();  }### Answer:
@Test public void testProposeContainingColumnWidthWhenLargerThanExisting() { when(gridColumn.getWidth()).thenReturn(100.0); tuple.proposeContainingColumnWidth(200.0, BaseExpressionGrid.RESIZE_EXISTING); verify(gridColumn).setWidth(200.0); }
@Test public void testProposeContainingColumnWidthWhenSmallerThanExisting() { when(gridColumn.getWidth()).thenReturn(100.0); tuple.proposeContainingColumnWidth(50.0, BaseExpressionGrid.RESIZE_EXISTING); verify(gridColumn).setWidth(50.0); }
@Test public void testProposeContainingColumnWidthWhenSmallerThanExistingEditor() { gridData.setCell(0, 0, () -> new DMNGridCell<>(new ExpressionCellValue(Optional.of(existingEditor)))); when(existingEditor.getPadding()).thenReturn(BaseExpressionGrid.DEFAULT_PADDING); when(existingEditor.getMinimumWidth()).thenReturn(200.0); when(gridColumn.getWidth()).thenReturn(100.0); tuple.proposeContainingColumnWidth(50.0, BaseExpressionGrid.RESIZE_EXISTING_MINIMUM); verify(gridColumn).setWidth(220.0); }
@Test public void testProposeContainingColumnWidthWhenLargerThanExistingEditor() { gridData.setCell(0, 0, () -> new DMNGridCell<>(new ExpressionCellValue(Optional.of(existingEditor)))); when(existingEditor.getPadding()).thenReturn(BaseExpressionGrid.DEFAULT_PADDING); when(existingEditor.getMinimumWidth()).thenReturn(200.0); when(gridColumn.getWidth()).thenReturn(100.0); tuple.proposeContainingColumnWidth(300.0, BaseExpressionGrid.RESIZE_EXISTING); verify(gridColumn).setWidth(300.0); }