use of org.talend.dataprep.transformation.pipeline.link.CloneLink in project data-prep by Talend.
the class NodeBuilderTest method should_append__clone_link_then_zip_to_a_common_node.
@Test
public void should_append__clone_link_then_zip_to_a_common_node() {
// given
final Node firstNode = new BasicNode();
final Node branch1 = new BasicNode();
final Node branch2 = new BasicNode();
final Node zipTarget = new BasicNode();
// when
final Node node = NodeBuilder.from(firstNode).dispatchTo(branch1, branch2).zipTo(zipTarget).build();
// then
assertThat(node, is(firstNode));
assertThat(node.getLink(), instanceOf(CloneLink.class));
assertThat(((CloneLink) node.getLink()).getNodes(), arrayContaining(branch1, branch2));
assertThat(branch1.getLink(), instanceOf(ZipLink.Zipper.class));
assertThat(branch2.getLink(), instanceOf(ZipLink.Zipper.class));
assertThat(branch1.getLink().getTarget(), is(zipTarget));
assertThat(branch2.getLink().getTarget(), is(zipTarget));
}
Aggregations