### Question:
PrefetchTreeNode implements Serializable, XMLSerializable { public PrefetchTreeNode cloneJointSubtree() { return cloneJointSubtree(null); } PrefetchTreeNode(); protected  PrefetchTreeNode(PrefetchTreeNode parent, String name); static PrefetchTreeNode withPath(String path, int semantics); @Override void encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate); PrefetchTreeNode getRoot(); String getPath(); String getPath(PrefetchTreeNode upTillParent); Collection<PrefetchTreeNode> adjacentJointNodes(); Collection<PrefetchTreeNode> jointNodes(); Collection<PrefetchTreeNode> disjointNodes(); Collection<PrefetchTreeNode> disjointByIdNodes(); Collection<PrefetchTreeNode> nonPhantomNodes(); PrefetchTreeNode cloneJointSubtree(); void traverse(PrefetchProcessor processor); PrefetchTreeNode getNode(String path); PrefetchTreeNode addPath(String path); void merge(PrefetchTreeNode node); void removePath(String path); void addChild(PrefetchTreeNode child); void removeChild(PrefetchTreeNode child); PrefetchTreeNode getParent(); Collection<PrefetchTreeNode> getChildren(); boolean hasChildren(); String getName(); boolean isPhantom(); void setPhantom(boolean phantom); int getSemantics(); void setSemantics(int semantics); boolean isJointPrefetch(); boolean isDisjointPrefetch(); boolean isDisjointByIdPrefetch(); String getEjbqlPathEntityId(); void setEjbqlPathEntityId(String ejbqlPathEntityId); String getEntityName(); void setEntityName(String entityName); static final int UNDEFINED_SEMANTICS; static final int JOINT_PREFETCH_SEMANTICS; static final int DISJOINT_PREFETCH_SEMANTICS; static final int DISJOINT_BY_ID_PREFETCH_SEMANTICS; }### Answer:
@Test public void testCloneJointSubtree() throws Exception { PrefetchTreeNode root = new PrefetchTreeNode(null, "root"); root.setPhantom(false); PrefetchTreeNode joint1 = root.addPath("joint1"); joint1.setPhantom(false); joint1.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS); PrefetchTreeNode joint2 = root.addPath("joint2"); joint2.setPhantom(false); joint2.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS); PrefetchTreeNode disjoint = joint1.addPath("disjoint1"); disjoint.setPhantom(false); disjoint.setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS); PrefetchTreeNode cloned = root.cloneJointSubtree(); assertEquals("root", cloned.getName()); assertEquals(2, cloned.getChildren().size()); PrefetchTreeNode joint1Clone = cloned.getChild("joint1"); assertNotNull(joint1Clone); assertEquals("joint1", joint1.getPath()); assertEquals(0, joint1Clone.getChildren().size()); PrefetchTreeNode joint2Clone = cloned.getChild("joint2"); assertNotNull(joint2Clone); assertEquals("joint2", joint2.getPath()); assertEquals(0, joint2Clone.getChildren().size()); }