@@ -0,0 +1,1047 @@
+package uk.org.taverna.scufl2.api.common;%0A%0Aimport org.junit.Test;%0A%0Aimport uk.org.taverna.scufl2.api.ExampleWorkflow;%0Aimport uk.org.taverna.scufl2.api.common.Visitor.VisitorAdapter;%0Aimport uk.org.taverna.scufl2.api.container.WorkflowBundle;%0A%0Apublic class TestSetParent %7B%0A%09WorkflowBundle example = new ExampleWorkflow().makeWorkflowBundle();%0A%0A%09Scufl2Tools tools = new Scufl2Tools();%0A%0A%09@Test%0A%09public void checkParents() throws Exception %7B%0A%09%09example.accept(new VisitorAdapter() %7B%0A%09%09%09@Override%0A%09%09%09public boolean visit(WorkflowBean node) %7B%0A%09%09%09%09if (node instanceof Child) %7B%0A%09%09%09%09%09Child child = (Child) node;%0A%09%09%09%09%09WorkflowBean parent = child.getParent();%0A%09%09%09%09%09WorkflowBean expectedParent = getCurrentPath().peek();%0A%09%09%09%09%09if (!(parent == expectedParent)) %7B%0A%09%09%09%09%09%09throw new IllegalStateException(%22Wrong parent for %22%0A%09%09%09%09%09%09%09%09+ node + %22: %22 + parent + %22, expected: %22%0A%09%09%09%09%09%09%09%09+ expectedParent);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public boolean visitEnter(WorkflowBean node) %7B%0A%09%09%09%09visit(node);%0A%09%09%09%09return super.visitEnter(node);%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%7D%0A

Test that all parents are set