### Question:
PageObjectReference extends EntityReference { @Override public PageObjectReference replaceParent(EntityReference oldParent, EntityReference newParent) { if (newParent == oldParent) { return this; } return new PageObjectReference(this, oldParent, newParent); } PageObjectReference(EntityReference reference); protected  PageObjectReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  PageObjectReference(String objectName, PageReference pageReference);  PageObjectReference(EntityReference reference, EntityReference parent); @Override PageObjectReference replaceParent(EntityReference oldParent, EntityReference newParent); @Override PageObjectReference replaceParent(EntityReference newParent); @Transient PageReference getPageReference();  }### Answer:
@Test public void testReplaceParent() { PageObjectReference reference = new PageObjectReference("object", new PageReference("wiki", "space", "page")) .replaceParent(new PageReference("wiki2", "space2", "page2")); assertEquals(new PageObjectReference("object", new PageReference("wiki2", "space2", "page2")), reference); assertSame(reference, reference.replaceParent(reference.getParent())); }