### Question:
PageReference extends AbstractLocalizedEntityReference { @Override public PageReference replaceParent(EntityReference oldParent, EntityReference newParent) { if (newParent == oldParent) { return this; } return new PageReference(this, oldParent, newParent); } PageReference(EntityReference reference); protected  PageReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  PageReference(String pageName, WikiReference parent);  PageReference(String pageName, PageReference parent);  PageReference(String pageName, EntityReference parent);  PageReference(String pageName, EntityReference parent, Locale locale);  PageReference(EntityReference reference, Locale locale);  PageReference(String wikiName, List<String> pageNames);  PageReference(String wikiName, List<String> pageNames, Locale locale);  PageReference(String wikiName, String pageName, String... pageNames);  PageReference(LocalPageReference localPageReference, WikiReference wikiReference);  PageReference(EntityReference reference, EntityReference parent); @Override PageReference replaceParent(EntityReference oldParent, EntityReference newParent); @Override PageReference replaceParent(EntityReference newParent); @Transient WikiReference getWikiReference(); @Override String toString(); static final Type TYPE_PROVIDER; }### Answer:
@Test public void testReplaceParent() { PageReference reference = new PageReference("wiki", "space", "page").replaceParent( new EntityReference("space2", EntityType.PAGE, new EntityReference("wiki2", EntityType.WIKI))); assertEquals(new PageReference("wiki2", "space2", "page"), reference); assertSame(reference, reference.replaceParent(reference.getParent())); }