Search in sources :

Example 6 with ActionValueEditor

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();
}
Also used : ActionValueEditor(org.drools.workbench.screens.guided.rule.client.editor.ActionValueEditor) ActionFieldValue(org.drools.workbench.models.datamodel.rule.ActionFieldValue) Test(org.junit.Test)

Aggregations

ActionValueEditor (org.drools.workbench.screens.guided.rule.client.editor.ActionValueEditor)6 ActionFieldValue (org.drools.workbench.models.datamodel.rule.ActionFieldValue)4 Test (org.junit.Test)4 Command (com.google.gwt.user.client.Command)2 HashMap (java.util.HashMap)2 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)1