@Test public void testAddAssigneesWithoutMax() { widget.addAssignee(); widget.addAssignee(); widget.addAssignee(); widget.addAssignee(); widget.addAssignee(); widget.addAssignee(); widget.addAssignee(); verify(listItems, times(7)).get(); verify(view, times(7)).add(any()); }
private void addAssignee(Assignee assignee) { AssigneeListItem listItem = listItems.get(); listItem.init(type, assignee, this::doSave, this::removeAssignee, this::onError); assigneeRows.add(listItem); view.add(listItem); if (max != -1 && assigneeRows.size() == max) { view.disableAddButton(); } }
AssigneeEditorWidget implements IsWidget,
                                             AssigneeEditorWidgetView.Presenter { private void addAssignee(Assignee assignee) { AssigneeListItem listItem = listItems.get(); listItem.init(type, assignee, this::doSave, this::removeAssignee, this::onError); assigneeRows.add(listItem); view.add(listItem); if (max != -1 && assigneeRows.size() == max) { view.disableAddButton(); } } }
AssigneeEditorWidget implements IsWidget,
                                             AssigneeEditorWidgetView.Presenter { private void addAssignee(Assignee assignee) { AssigneeListItem listItem = listItems.get(); listItem.init(type, assignee, this::doSave, this::removeAssignee, this::onError); assigneeRows.add(listItem); view.add(listItem); if (max != -1 && assigneeRows.size() == max) { view.disableAddButton(); } } @Inject  AssigneeEditorWidget(AssigneeEditorWidgetView view,
                                ManagedInstance<AssigneeListItem> listItems,
                                TranslationService translationService,
                                Event<NotificationEvent> notification); }
AssigneeEditorWidget implements IsWidget,
                                             AssigneeEditorWidgetView.Presenter { private void addAssignee(Assignee assignee) { AssigneeListItem listItem = listItems.get(); listItem.init(type, assignee, this::doSave, this::removeAssignee, this::onError); assigneeRows.add(listItem); view.add(listItem); if (max != -1 && assigneeRows.size() == max) { view.disableAddButton(); } } @Inject  AssigneeEditorWidget(AssigneeEditorWidgetView view,
                                ManagedInstance<AssigneeListItem> listItems,
                                TranslationService translationService,
                                Event<NotificationEvent> notification); void init(AssigneeType type, int max); @Override String getValue(); @Override void setValue(String value); @Override void setValue(String newValue, boolean fireEvents); @Override Widget asWidget(); @Override void doSave(); void deserializeAssignees(String serializedValue); String serializeAssignees(List<Assignee> assigneeRows); @Override void addAssignee(); @Override boolean isDuplicateName(String name); void removeAssignee(AssigneeListItem listItem); @Override void fireEvent(GwtEvent<?> gwtEvent); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override String getNameHeader(); @Override String getAddLabel(); @PreDestroy void destroy(); void setReadOnly(boolean readOnly); }
AssigneeEditorWidget implements IsWidget,
                                             AssigneeEditorWidgetView.Presenter { private void addAssignee(Assignee assignee) { AssigneeListItem listItem = listItems.get(); listItem.init(type, assignee, this::doSave, this::removeAssignee, this::onError); assigneeRows.add(listItem); view.add(listItem); if (max != -1 && assigneeRows.size() == max) { view.disableAddButton(); } } @Inject  AssigneeEditorWidget(AssigneeEditorWidgetView view,
                                ManagedInstance<AssigneeListItem> listItems,
                                TranslationService translationService,
                                Event<NotificationEvent> notification); void init(AssigneeType type, int max); @Override String getValue(); @Override void setValue(String value); @Override void setValue(String newValue, boolean fireEvents); @Override Widget asWidget(); @Override void doSave(); void deserializeAssignees(String serializedValue); String serializeAssignees(List<Assignee> assigneeRows); @Override void addAssignee(); @Override boolean isDuplicateName(String name); void removeAssignee(AssigneeListItem listItem); @Override void fireEvent(GwtEvent<?> gwtEvent); @Override HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> handler); @Override String getNameHeader(); @Override String getAddLabel(); @PreDestroy void destroy(); void setReadOnly(boolean readOnly);  }