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());
}
Aggregations