/** * Set ComboBox value * @param value the ComboBox value to set * @throws VerificationException if the element doesn't exist */ @SuppressWarnings( "unchecked") @Override @PublicAtsApi public void setValue( String value ) { new SwingElementState(this).waitToBecomeExisting(); JComboBoxFixture comboBoxFixture = null; try { comboBoxFixture = ((JComboBoxFixture) SwingElementLocator.findFixture(this)); comboBoxFixture.selectItem(value); } catch (LocationUnavailableException lue) { // an element matching the given text cannot be found // if the element is editable we'll enter the new value if (comboBoxFixture != null && comboBoxFixture.component().isEditable()) { try { comboBoxFixture.component().addItem(value); comboBoxFixture.selectItem(value); } catch (LocationUnavailableException e) { throw new UiElementException(e.getMessage(), this); } } else { throw new UiElementException(lue.getMessage(), this); } } }
@Test @Ignore(value = "Intellij component dependency, need to mock it") public void testLaunchBuild() throws Exception { createDialog(JOB_WITH_GOOD_PARAMS); dialogFixture.checkBox("integrationTest").uncheck(); dialogFixture.comboBox("environment").selectItem("acceptance"); dialogFixture.button(JButtonMatcher.withText("OK")).click(); ArgumentCaptor<Map> paramMap = ArgumentCaptor.forClass(Map.class); verify(requestManager, times(1)).runParameterizedBuild(any(Job.class), any(JenkinsAppSettings.class), paramMap.capture()); Map expectedParamMapValue = paramMap.getValue(); assertEquals(3, expectedParamMapValue.size()); assertEquals("false", expectedParamMapValue.get("integrationTest")); assertEquals("acceptance", expectedParamMapValue.get("environment")); assertEquals("", expectedParamMapValue.get("message")); }