### Question:
ImportsWidgetPresenter implements ImportsWidgetView.Presenter,
                                               IsWidget { @Override public void setContent(final AsyncPackageDataModelOracle dmo, final Imports importTypes, final boolean isReadOnly) { this.dmo = checkNotNull("dmo", dmo); this.importTypes = checkNotNull("importTypes", importTypes); getInternalFactTypes().clear(); getExternalFactTypes().clear(); getModelFactTypes().clear(); for (String importType : dmo.getInternalFactTypes()) { getInternalFactTypes().add(new Import(importType.replaceAll("\\$", "."))); } for (String importType : dmo.getExternalFactTypes()) { getExternalFactTypes().add(new Import(importType.replaceAll("\\$", "."))); } getModelFactTypes().addAll(importTypes.getImports()); getModelFactTypes().removeAll(getInternalFactTypes()); getExternalFactTypes().removeAll(getModelFactTypes()); view.setContent(getInternalFactTypes(), getExternalFactTypes(), getModelFactTypes(), isReadOnly); view.updateRenderedColumns(); } ImportsWidgetPresenter(); @Inject  ImportsWidgetPresenter(final ImportsWidgetView view,
                                  final Event<ImportAddedEvent> importAddedEvent,
                                  final Event<ImportRemovedEvent> importRemovedEvent); @Override void setContent(final AsyncPackageDataModelOracle dmo,
                           final Imports importTypes,
                           final boolean isReadOnly); @Override boolean isInternalImport(final Import importType); @Override void onAddImport(final Import importType); @Override void onRemoveImport(final Import importType); @Override Widget asWidget();  }### Answer:
@Test public void testSetContent() { final Imports imports = new Imports(); imports.addImport(new Import("Internal1")); presenter.setContent(dmo, imports, false); verify(view, times(1)).setContent(internalFactTypesCaptor.capture(), externalFactTypesCaptor.capture(), importsFactTypesCaptor.capture(), eq(false)); verify(view).updateRenderedColumns(); assertEquals(3, internalFactTypesCaptor.getValue().size()); assertContains("Internal1", internalFactTypesCaptor.getValue()); assertContains("Internal2", internalFactTypesCaptor.getValue()); assertContains("Internal3", internalFactTypesCaptor.getValue()); assertEquals(3, externalFactTypesCaptor.getValue().size()); assertContains("org.pkg1.External1", externalFactTypesCaptor.getValue()); assertContains("org.pkg1.External2", externalFactTypesCaptor.getValue()); assertContains("org.pkg1.External3", externalFactTypesCaptor.getValue()); assertEquals(0, importsFactTypesCaptor.getValue().size()); assertEquals(1, imports.getImports().size()); assertContains("Internal1", imports.getImports()); }
@Test public void testSetContentWithExternalImport() { final Imports imports = new Imports(); imports.addImport(new Import("org.pkg1.External1")); presenter.setContent(dmo, imports, false); verify(view, times(1)).setContent(internalFactTypesCaptor.capture(), externalFactTypesCaptor.capture(), importsFactTypesCaptor.capture(), eq(false)); assertEquals(3, internalFactTypesCaptor.getValue().size()); assertContains("Internal1", internalFactTypesCaptor.getValue()); assertContains("Internal2", internalFactTypesCaptor.getValue()); assertContains("Internal3", internalFactTypesCaptor.getValue()); assertEquals(2, externalFactTypesCaptor.getValue().size()); assertContains("org.pkg1.External2", externalFactTypesCaptor.getValue()); assertContains("org.pkg1.External3", externalFactTypesCaptor.getValue()); assertEquals(1, importsFactTypesCaptor.getValue().size()); assertContains("org.pkg1.External1", importsFactTypesCaptor.getValue()); assertEquals(1, imports.getImports().size()); assertContains("org.pkg1.External1", imports.getImports()); }