ScenarioSimulationKogitoCreationPopupView extends AbstractScenarioPopupView implements ScenarioSimulationKogitoCreationPopup { protected void initializeDropdown() { dmnAssetsDivElement.appendChild(scenarioSimulationKogitoCreationAssetsDropdown.getElement()); scenarioSimulationKogitoCreationAssetsDropdown.clear(); scenarioSimulationKogitoCreationAssetsDropdown.init(); scenarioSimulationKogitoCreationAssetsDropdown.initializeDropdown(); scenarioSimulationKogitoCreationAssetsDropdown.registerOnChangeHandler(() -> { final Optional<KieAssetsDropdownItem> value = scenarioSimulationKogitoCreationAssetsDropdown.getValue(); selectedPath = value.map(KieAssetsDropdownItem::getValue).orElse(null); enableCreateButtonForDMNScenario(); }); }  @Override void show(String mainTitleText, Command okCommand); @Override ScenarioSimulationModel.Type getSelectedType(); @Override String getSelectedPath(); @EventHandler("dmn-button") void onDmnClick(final ClickEvent event); @EventHandler("rule-button") void onRuleClick(final ClickEvent event);  }
@Test public void initializeDropdown() { when(scenarioSimulationKogitoCreationAssetsDropdownMock.getValue()).thenReturn(Optional.of(new KieAssetsDropdownItem("text", "subtext", "path/file.dmn", Collections.emptyMap()))); scenarioSimulationCreationPopupViewSpy.initializeDropdown(); verify(dmnAssetsDivElementMock, times(1)).appendChild(eq(htmlElementMock)); verify(scenarioSimulationKogitoCreationAssetsDropdownMock, times(1)).clear(); verify(scenarioSimulationKogitoCreationAssetsDropdownMock, times(1)).init(); verify(scenarioSimulationKogitoCreationAssetsDropdownMock, times(1)).initializeDropdown(); verify(scenarioSimulationKogitoCreationAssetsDropdownMock, times(1)).registerOnChangeHandler(commandArgumentCaptor.capture()); commandArgumentCaptor.getValue().execute(); verify(scenarioSimulationCreationPopupViewSpy, times(1)).enableCreateButtonForDMNScenario(); assertEquals("path/file.dmn", scenarioSimulationCreationPopupViewSpy.selectedPath); }