### Question:
VariablesEditorFieldRenderer extends FieldRenderer<VariablesEditorFieldDefinition, DefaultFormGroup> implements VariablesEditorWidgetView.Presenter { @Override public void addVariable() { List<VariableRow> as = view.getVariableRows(); if (as.isEmpty()) { view.setTableDisplayStyle(); } as.add(createVariableRow()); VariableListItemWidgetView widget = view.getVariableWidget(view.getVariableRowsCount() - 1); widget.setDataTypes(dataTypeListBoxValues); widget.setParentWidget(this); checkTagsNotEnabled(); } @Inject  VariablesEditorFieldRenderer(final VariablesEditorWidgetView variablesEditor,
                                        final SessionManager sessionManager,
                                        final ErrorPopupPresenter errorPopupPresenter); @Override String getName(); @Override void doSave(); @Override void addVariable(); @Override void setDataTypes(final List<String> dataTypes,
                             final List<String> dataTypeDisplayNames); @Override void notifyModelChanged(); @Override List<VariableRow> deserializeVariables(final String s); @Override String serializeVariables(final List<VariableRow> variableRows); @Override boolean isDuplicateName(final String name); @Override boolean isBoundToNodes(String name); @Override void removeVariable(final VariableRow variableRow); @Override ListBoxValues.ValueTester dataTypesTester(); @Override Path getDiagramPath(); void setLastOverlayOpened(final Button overlayCloseButton); Button getLastOverlayOpened(); void closeLastOverlay(); static Set<String> getDefaultTagsSet();  }### Answer:
@Test public void testAddVariable() { when(variablesEditorWidgetView.getVariableWidget(anyInt())).thenReturn(variableListItemWidgetView); when(variablesEditorWidgetView.getVariableRowsCount()).thenReturn(1); variablesEditor.addVariable(); verify(variablesEditorWidgetView, times(1)).setTableDisplayStyle(); verify(variablesEditorWidgetView, times(1)).getVariableRowsCount(); verify(variablesEditorWidgetView, times(1)).getVariableWidget(0); when(variablesEditorWidgetView.getVariableRowsCount()).thenReturn(2); variablesEditor.addVariable(); verify(variablesEditorWidgetView, times(2)).getVariableRowsCount(); verify(variablesEditorWidgetView, times(1)).getVariableWidget(1); }