### Question:
AddImportPopup extends BaseModal { public void setContent(final Command callbackCommand, final List<Import> allAvailableImportTypes) { this.callbackCommand = callbackCommand; this.importTypeListBox.clear(); if (allAvailableImportTypes.size() > 0) { allAvailableImportTypes.sort(Sorters.sortByFQCN()); importTypeListBox.addItem(ImportConstants.INSTANCE.ChooseAFactType()); for (Import importType : allAvailableImportTypes) { importTypeListBox.addItem(importType.getType()); } importTypeListBox.setEnabled(true); } else { importTypeListBox.addItem(ImportConstants.INSTANCE.noTypesAvailable()); importTypeListBox.setEnabled(false); } footer.enableOkButton(false); importTypeListBox.setSelectedIndex(0); } AddImportPopup(); String getImportType(); void setContent(final Command callbackCommand,
                           final List<Import> allAvailableImportTypes);  }### Answer:
@Test public void setContentEmpty() { popup.setContent(mock(Command.class), externalFactTypes); verify(importTypeListBox).clear(); verify(importTypeListBox).addItem(importTypesCaptor.capture()); final List<String> importTypes = importTypesCaptor.getAllValues(); assertEquals(1, importTypes.size()); assertEquals(ImportConstants.INSTANCE.noTypesAvailable(), importTypes.get(0)); verify(importTypeListBox).addItem(ImportConstants.INSTANCE.noTypesAvailable()); verify(importTypeListBox).setSelectedIndex(0); verify(importTypeListBox).setEnabled(false); }
@Test public void setContentOrdersImportsAlphabetically() { externalFactTypes.add(external1); externalFactTypes.add(external2); popup.setContent(mock(Command.class), externalFactTypes); verify(importTypeListBox).clear(); verify(importTypeListBox, times(3)).addItem(importTypesCaptor.capture()); final List<String> importTypes = importTypesCaptor.getAllValues(); assertEquals(3, importTypes.size()); assertEquals(ImportConstants.INSTANCE.ChooseAFactType(), importTypes.get(0)); assertEquals(external2.getType(), importTypes.get(1)); assertEquals(external1.getType(), importTypes.get(2)); final InOrder inOrder = inOrder(importTypeListBox); inOrder.verify(importTypeListBox).addItem(ImportConstants.INSTANCE.ChooseAFactType()); inOrder.verify(importTypeListBox).addItem(importTypes.get(1)); inOrder.verify(importTypeListBox).addItem(importTypes.get(2)); inOrder.verify(importTypeListBox).setEnabled(true); inOrder.verify(importTypeListBox).setSelectedIndex(0); }