Search in sources :

Example 1 with DataOutputAssociationImpl

use of org.eclipse.bpmn2.impl.DataOutputAssociationImpl in project kie-wb-common by kiegroup.

the class OutputAssignmentReaderTest method testFromAssociationWithExpression.

@Test
public void testFromAssociationWithExpression() {
    DataOutput output = spy(DataOutput.class);
    when(output.getName()).thenReturn(TARGET_NAME);
    Assignment assignment = spy(Assignment.class);
    FormalExpression to = mock(FormalExpression.class);
    when(assignment.getTo()).thenReturn(to);
    when(to.getBody()).thenReturn(SOURCE_NAME);
    List<Assignment> assignments = new ArrayList<Assignment>();
    assignments.add(assignment);
    DataOutputAssociationImpl out = spy(DataOutputAssociationImpl.class);
    when(out.getAssignment()).thenReturn(assignments);
    OutputAssignmentReader outputReader = OutputAssignmentReader.fromAssociation(out);
    assertNull(outputReader);
    List<ItemAwareElement> outputs = new ArrayList<>();
    outputs.add(output);
    when(out.getSourceRef()).thenReturn(outputs);
    outputReader = OutputAssignmentReader.fromAssociation(out);
    assertResult(TARGET_NAME, SOURCE_NAME, AssociationDeclaration.Type.FromTo, outputReader.getAssociationDeclaration());
    when(to.getBody()).thenReturn("null");
    outputReader = OutputAssignmentReader.fromAssociation(out);
    assertResult(TARGET_NAME, "", AssociationDeclaration.Type.FromTo, outputReader.getAssociationDeclaration());
}
Also used : Assignment(org.eclipse.bpmn2.Assignment) DataOutput(org.eclipse.bpmn2.DataOutput) DataOutputAssociationImpl(org.eclipse.bpmn2.impl.DataOutputAssociationImpl) ArrayList(java.util.ArrayList) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) FormalExpression(org.eclipse.bpmn2.FormalExpression) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Assignment (org.eclipse.bpmn2.Assignment)1 DataOutput (org.eclipse.bpmn2.DataOutput)1 FormalExpression (org.eclipse.bpmn2.FormalExpression)1 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)1 DataOutputAssociationImpl (org.eclipse.bpmn2.impl.DataOutputAssociationImpl)1 Test (org.junit.Test)1