### Question:
PdfVersionCombo extends ComboBox<PdfVersionComboItem> implements ModuleOwned, ResettableView { public void enableSameAsSourceItem() { unfilteredItems.add(0, sameAsSource); getSelectionModel().selectFirst(); } PdfVersionCombo(String ownerModule); @EventListener void onAddPdfVersionConstraint(final AddPdfVersionConstraintEvent event); @EventListener void onRemovePdfVersionConstraint(final RemovePdfVersionConstraintEvent event); @EventListener void onChangedSelectedPdfVersion(final ChangedSelectedPdfVersionEvent event); @Override @EventStation String getOwnerModule(); @Override void resetView(); void enableSameAsSourceItem();  }### Answer:
@Test public void enableSameAsSource() { int comboSize = victim.getItems().size(); victim.enableSameAsSourceItem(); assertEquals(comboSize + 1, victim.getItems().size()); }
@Test public void sameAsSourceVersion() { victim.enableSameAsSourceItem(); eventStudio().broadcast(new ChangedSelectedPdfVersionEvent(PdfVersion.VERSION_1_4), MODULE); long values = victim.getItems().stream().filter(i -> i.getVersion().equals(PdfVersion.VERSION_1_4)).count(); assertEquals(2, values); }
@Test public void sameAsSourceVersionLowerThenConstraint() { victim.enableSameAsSourceItem(); eventStudio().broadcast(new AddPdfVersionConstraintEvent(PdfVersion.VERSION_1_5), MODULE); assertEquals(4, victim.getItems().size()); eventStudio().broadcast(new ChangedSelectedPdfVersionEvent(PdfVersion.VERSION_1_4), MODULE); assertEquals(3, victim.getItems().size()); }
@Test public void lowestIsSelected() { victim.enableSameAsSourceItem(); eventStudio().broadcast(new ChangedSelectedPdfVersionEvent(PdfVersion.VERSION_1_4), MODULE); eventStudio().broadcast(new AddPdfVersionConstraintEvent(PdfVersion.VERSION_1_5), MODULE); assertEquals(PdfVersion.VERSION_1_5, victim.getSelectionModel().getSelectedItem().getVersion()); }