@Override public String addCustomValueToListBoxValues(String newValue, String oldValue) { if (quoteStringValues) { newValue = StringUtils.createQuotedConstant(newValue); oldValue = StringUtils.createQuotedConstant(oldValue); } return listBoxValues.addCustomValue(newValue, oldValue); }
@Test public void testProcessVarComboBox() { initComboBoxTest( processVarQuoteStringValues, processVarConstantPrompt, processVarConstantPlaceholder, processVarEditPrefix, processVarEditSuffix, processVarListBoxStartValues); setNonCustomValue(processVarListBoxStartValues.get(2), 1); String customStringValue1 = "first constant"; setCustomValue(customStringValue1); setNonCustomValue(processVarListBoxStartValues.get(2), 2); String customNumericValue1 = "123"; setCustomValue(customNumericValue1); setNonCustomValue(StringUtils.createQuotedConstant(customStringValue1), 2); String customNumericValue2 = "123.456"; setCustomValue(customNumericValue2); aboutToEditCustomValue(customNumericValue2, 2); String customNumericValue3 = "100"; editCustomValue(customNumericValue3); String customStringValue2 = "second constant"; setCustomValue(customStringValue2); setNonCustomValue(StringUtils.createQuotedConstant(customStringValue1), 3); setNonCustomValue(processVarListBoxStartValues.get(2), 3); assertTrue( getListBoxValues() .getAcceptableValuesWithCustomValues() .contains(StringUtils.createQuotedConstant(customStringValue1))); assertTrue( getListBoxValues().getAcceptableValuesWithCustomValues().contains(customNumericValue1)); assertTrue( !getListBoxValues().getAcceptableValuesWithCustomValues().contains(customNumericValue2)); assertTrue( getListBoxValues().getAcceptableValuesWithCustomValues().contains(customNumericValue3)); assertTrue( getListBoxValues() .getAcceptableValuesWithCustomValues() .contains(StringUtils.createQuotedConstant(customStringValue2))); // System.out.println(comboBox.getListBoxValues().toString()); }
private void editCustomValue(String value) { comboBox.view.textBoxGotFocus(); textBox.setValue(value); comboBox.view.textBoxLostFocus(); comboBox.view.listBoxGotFocus(); assertEquals(listBox.isVisible(), true); assertEquals(textBox.isVisible(), false); String listBoxValue = this.quoteStringValues ? StringUtils.createQuotedConstant(value) : value; verify(modelPresenter).setTextBoxModelValue(textBox, listBoxValue); assertEquals(comboBox.getValue(), listBoxValue); }