Search in sources :

Example 11 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetTest method initTestCase.

@Before
public void initTestCase() {
    GwtMockito.initMocks(this);
    dataType = mock(ValueListBox.class);
    processVar = mock(ValueListBox.class);
    customDataType = mock(TextBox.class);
    constant = mock(TextBox.class);
    dataTypeComboBox = mock(ComboBox.class);
    processVarComboBox = mock(ComboBox.class);
    widget = GWT.create(AssignmentListItemWidgetViewImpl.class);
    AssignmentRow assignmentRow = new AssignmentRow();
    widget.dataType = dataType;
    widget.customDataType = customDataType;
    widget.processVar = processVar;
    widget.constant = constant;
    widget.dataTypeComboBox = dataTypeComboBox;
    widget.name = name;
    widget.deleteButton = deleteButton;
    widget.processVarComboBox = processVarComboBox;
    widget.assignment = assignment;
    Mockito.doCallRealMethod().when(widget).setTextBoxModelValue(any(TextBox.class), anyString());
    Mockito.doCallRealMethod().when(widget).setListBoxModelValue(any(ValueListBox.class), anyString());
    Mockito.doCallRealMethod().when(widget).getModelValue(any(ValueListBox.class));
    Mockito.doCallRealMethod().when(widget).setDataType(anyString());
    Mockito.doCallRealMethod().when(widget).getDataType();
    Mockito.doCallRealMethod().when(widget).setCustomDataType(anyString());
    Mockito.doCallRealMethod().when(widget).getCustomDataType();
    Mockito.doCallRealMethod().when(widget).setConstant(anyString());
    Mockito.doCallRealMethod().when(widget).getConstant();
    Mockito.doCallRealMethod().when(widget).setProcessVar(anyString());
    Mockito.doCallRealMethod().when(widget).getProcessVar();
    Mockito.doCallRealMethod().when(widget).setDataTypes(any(ListBoxValues.class));
    Mockito.doCallRealMethod().when(widget).setProcessVariables(any(ListBoxValues.class));
    Mockito.doCallRealMethod().when(widget).init();
    Mockito.doCallRealMethod().when(widget).setModel(any(AssignmentRow.class));
    Mockito.doCallRealMethod().when(processVarComboBox).setAddCustomValues(any(Boolean.class));
    Mockito.doCallRealMethod().when(processVarComboBox).addCustomValueToListBoxValues(any(String.class), any(String.class));
    Mockito.doCallRealMethod().when(processVarComboBox).setListBoxValues(any(ListBoxValues.class));
    when(widget.getModel()).thenReturn(assignmentRow);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) ValueListBox(org.gwtbootstrap3.client.ui.ValueListBox) ComboBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox) TextBox(org.gwtbootstrap3.client.ui.TextBox) VariableNameTextBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox) Mockito.anyString(org.mockito.Mockito.anyString) ListBoxValues(org.kie.workbench.common.stunner.bpmn.client.forms.util.ListBoxValues) Mockito.anyBoolean(org.mockito.Mockito.anyBoolean) Before(org.junit.Before)

Example 12 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetTest method testSetModelOutput.

@Test
public void testSetModelOutput() {
    when(widget.getVariableType()).thenReturn(Variable.VariableType.OUTPUT);
    widget.setModel(new AssignmentRow());
    verify(deleteButton).setIcon(IconType.TRASH);
    verify(constant).setVisible(false);
    verify(widget).getCustomDataType();
    verify(widget).getDataType();
    verify(widget).getConstant();
    verify(widget).getProcessVar();
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Test(org.junit.Test)

Example 13 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetTest method testQuotedConstant1.

@Test
public void testQuotedConstant1() {
    AssignmentRow row = new AssignmentRow();
    String s = "abc";
    row.setConstant(s);
    when(widget.getModel()).thenReturn(row);
    widget.setModel(row);
    verify(constant).setValue(s);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.Test)

Example 14 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetTest method testQuotedConstant2.

@Test
public void testQuotedConstant2() {
    AssignmentRow row = new AssignmentRow();
    String s = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout.";
    row.setConstant(s);
    when(widget.getModel()).thenReturn(row);
    widget.setModel(row);
    verify(constant).setValue(s);
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.Test)

Example 15 with AssignmentRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow in project kie-wb-common by kiegroup.

the class AssignmentListItemWidgetViewImplTest method setUp.

@Before
public void setUp() throws Exception {
    GwtMockito.initMocks(this);
    customDataType = mock(TextBox.class);
    constant = mock(TextBox.class);
    dataType = mock(ValueListBox.class);
    processVar = mock(ValueListBox.class);
    dataTypeComboBox = mock(ComboBox.class);
    processVarComboBox = mock(ComboBox.class);
    view = mock(AssignmentListItemWidgetViewImpl.class);
    view.assignment = assignment;
    view.name = name;
    view.deleteButton = deleteButton;
    view.customDataType = customDataType;
    view.dataType = dataType;
    view.constant = constant;
    view.processVar = processVar;
    view.dataTypeComboBox = dataTypeComboBox;
    view.processVarComboBox = processVarComboBox;
    view.notification = notification;
    doCallRealMethod().when(view).init();
    doCallRealMethod().when(view).getConstant();
    doCallRealMethod().when(view).setConstant(anyString());
    doCallRealMethod().when(view).getCustomDataType();
    doCallRealMethod().when(view).setCustomDataType(anyString());
    doCallRealMethod().when(view).getModel();
    doCallRealMethod().when(view).setModel(any(AssignmentRow.class));
    doCallRealMethod().when(view).getModelValue(any(ValueListBox.class));
    doCallRealMethod().when(view).setTextBoxModelValue(any(TextBox.class), anyString());
    doCallRealMethod().when(view).setListBoxModelValue(any(ValueListBox.class), anyString());
    doCallRealMethod().when(view).getDataType();
    doCallRealMethod().when(view).setDataType(anyString());
    doCallRealMethod().when(view).getProcessVar();
    doCallRealMethod().when(view).setProcessVar(anyString());
    doCallRealMethod().when(view).getVariableType();
    doCallRealMethod().when(view).setAllowDuplicateNames(anyBoolean(), anyString());
    doCallRealMethod().when(view).setParentWidget(any(ActivityDataIOEditorWidget.class));
    doCallRealMethod().when(view).isDuplicateName(anyString());
    doCallRealMethod().when(view).setShowConstants(anyBoolean());
    doCallRealMethod().when(view).setDisallowedNames(anySet(), anyString());
    doCallRealMethod().when(view).handleDeleteButton(any(ClickEvent.class));
    AssignmentRow row = new AssignmentRow();
    doReturn(row).when(assignment).getModel();
}
Also used : AssignmentRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow) ValueListBox(org.gwtbootstrap3.client.ui.ValueListBox) ComboBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) TextBox(org.gwtbootstrap3.client.ui.TextBox) VariableNameTextBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox) Before(org.junit.Before)

Aggregations

AssignmentRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.AssignmentRow)15 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 Mockito.anyString (org.mockito.Mockito.anyString)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 List (java.util.List)2 TextBox (org.gwtbootstrap3.client.ui.TextBox)2 ValueListBox (org.gwtbootstrap3.client.ui.ValueListBox)2 ComboBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox)2 VariableNameTextBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox)2 ListBoxValues (org.kie.workbench.common.stunner.bpmn.client.forms.util.ListBoxValues)1 Mockito.anyBoolean (org.mockito.Mockito.anyBoolean)1 Mockito.anyList (org.mockito.Mockito.anyList)1