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