use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.
the class NumericValuePairEditorBaseTest method createEditor.
protected NumericValuePairEditor createEditor(NumberType numberType, String paramName) {
NumericValuePairEditor numericEditor = new NumericValuePairEditor(singleEditorView);
AnnotationDefinition annotationDefinition = createAnnotationDefinition(numberType);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair(paramName);
numericEditor.init(valuePairDefinition);
return numericEditor;
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.
the class CharacterValuePairEditorTest method testInvalidValidValueChange.
@Test
public void testInvalidValidValueChange() {
CharacterValuePairEditor characterEditor = new CharacterValuePairEditor(view);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("charParam1");
characterEditor.init(valuePairDefinition);
when(view.getValue()).thenReturn("AFD");
characterEditor.onValueChange();
assertFalse(characterEditor.isValid());
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.
the class CharacterValuePairEditorTest method testValidValueChange.
@Test
public void testValidValueChange() {
CharacterValuePairEditor characterEditor = new CharacterValuePairEditor(view);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("charParam1");
characterEditor.init(valuePairDefinition);
when(view.getValue()).thenReturn(" A ");
characterEditor.onValueChange();
assertTrue(characterEditor.isValid());
// the editor internally trims the entered string
assertEquals("A", characterEditor.getValue());
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.
the class MultipleStringValuePairEditorTest method testEditorLoad.
@Test
public void testEditorLoad() {
stringEditors.clear();
List<String> originalValues = new ArrayList<String>();
originalValues.add("AAA");
originalValues.add("BBB");
originalValues.add("CCC");
MultipleStringValuePairEditor multiStringEditor = new MultipleStringValuePairEditorExtended(multipleEditorView);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("stringParam1");
multiStringEditor.init(valuePairDefinition);
verify(multipleEditorView, times(1)).setValuePairLabel(valuePairDefinition.getName());
verify(multipleEditorView, times(1)).showValuePairRequiredIndicator(false);
multiStringEditor.setValue(originalValues);
// three individual editors should have been created.
assertEquals(3, stringEditors.size());
// and populated with the corresponding value
verify(singleEditorView, times(1)).setValue("AAA");
verify(singleEditorView, times(1)).setValue("BBB");
verify(singleEditorView, times(1)).setValue("CCC");
assertTrue(multiStringEditor.isValid());
}
use of org.kie.workbench.common.services.datamodeller.core.AnnotationValuePairDefinition in project kie-wb-common by kiegroup.
the class StringValuePairEditorTest method testValidValueChange.
@Test
public void testValidValueChange() {
StringValuePairEditor stringEditor = new StringValuePairEditor(view);
AnnotationValuePairDefinition valuePairDefinition = annotationDefinition.getValuePair("stringParam1");
stringEditor.init(valuePairDefinition);
when(view.getValue()).thenReturn("ABCDE");
stringEditor.onValueChange();
assertTrue(stringEditor.isValid());
assertEquals("ABCDE", stringEditor.getValue());
}
Aggregations