use of org.drools.workbench.screens.guided.rule.client.editor.ActionValueEditor in project drools-wb by kiegroup.
the class ActionInsertFactWidgetTest method testOnChangeCallbackRegisteredForActionValueEditor.
@Test
public void testOnChangeCallbackRegisteredForActionValueEditor() throws Exception {
final ActionFieldValue value = new ActionFieldValue();
value.setNature(FieldNatureType.TYPE_LITERAL);
value.setField("a");
final ActionValueEditor editor = mock(ActionValueEditor.class);
doReturn(editor).when(testedWidget).actionValueEditor(anyString(), eq(value), any(), eq(readOnly));
final ActionFieldValue valueTwo = new ActionFieldValue();
valueTwo.setNature(FieldNatureType.TYPE_LITERAL);
valueTwo.setField("b");
final ActionValueEditor editorTwo = mock(ActionValueEditor.class);
doReturn(editorTwo).when(testedWidget).actionValueEditor(anyString(), eq(valueTwo), any(), eq(readOnly));
testedWidget.valueEditor(value);
testedWidget.valueEditor(valueTwo);
verify(editor).setOnChangeCommand(commandCaptor.capture());
commandCaptor.getValue().execute();
verify(testedWidget).setModified(true);
verify(editorTwo).refresh();
}
Aggregations