YeomanPartPresenter extends BasePresenter implements YeomanPartView.ActionDelegate,
                                                                  BuildFinishedCallback { public void removeItem(YeomanGeneratorType type, String name, GeneratedItemView itemView) { List<String> existingNames = namesByTypes.get(type); if (existingNames != null && existingNames.contains(name)) { existingNames.remove(name); if (existingNames.isEmpty()) { namesByTypes.remove(type); FoldingPanel previous = widgetByTypes.remove(type); view.removeFoldingPanel(previous); } else { FoldingPanel selectedPanel = widgetByTypes.get(type); selectedPanel.remove(itemView); } } updateGenerateButton(); } @Inject  YeomanPartPresenter(YeomanPartView view, FoldingPanelFactory foldingPanelFactory,
                               GeneratedItemViewFactory generatedItemViewFactory, DtoFactory dtoFactory,
                               BuilderAgent builderAgent, ProjectExplorerPresenter projectExplorer); @Override String getTitle(); @Override ImageResource getTitleImage(); @Override String getTitleToolTip(); @Override void go(AcceptsOneWidget container); void addItem(String generatedName, YeomanGeneratorType selectedType); @Override void onFinished(BuildStatus buildStatus); void generate(); void removeItem(YeomanGeneratorType type, String name, GeneratedItemView itemView); Map<YeomanGeneratorType, FoldingPanel> getWidgetByTypes(); Map<YeomanGeneratorType, List<String>> getNamesByTypes();  }
@Test public void testRemoveItem() { assertTrue(presenter.getNamesByTypes().isEmpty()); assertTrue(presenter.getWidgetByTypes().isEmpty()); presenter.addItem(CONTROLLER1, CONTROLLER); assertEquals(1, presenter.getWidgetByTypes().size()); assertEquals(1, presenter.getNamesByTypes().size()); presenter.removeItem(CONTROLLER, CONTROLLER1, itemController1); assertTrue(presenter.getNamesByTypes().isEmpty()); assertTrue(presenter.getWidgetByTypes().isEmpty()); verify(yeomanPartView).removeFoldingPanel(foldingPanelController); verify(yeomanPartView).removeFoldingPanel(any(FoldingPanel.class)); }