### Question:
SpaceReference extends EntityReference { @Override public SpaceReference replaceParent(EntityReference oldParent, EntityReference newParent) { if (newParent == oldParent) { return this; } return new SpaceReference(this, oldParent, newParent); } SpaceReference(EntityReference reference); protected  SpaceReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  SpaceReference(String spaceName, WikiReference parent);  SpaceReference(String spaceName, SpaceReference parent);  SpaceReference(String spaceName, EntityReference parent);  SpaceReference(String wikiName, String... spaceNames);  SpaceReference(String wikiName, List<String> spaceNames);  SpaceReference(EntityReference reference, EntityReference parent); @Override SpaceReference replaceParent(EntityReference oldParent, EntityReference newParent); @Override SpaceReference replaceParent(EntityReference newParent); @Transient WikiReference getWikiReference(); static final Type TYPE_PROVIDER; }### Answer:
@Test public void testReplaceParent() { SpaceReference reference = new SpaceReference("wiki", "space", "page").replaceParent( new EntityReference("space2", EntityType.SPACE, new EntityReference("wiki2", EntityType.WIKI))); assertEquals(new SpaceReference("wiki2", "space2", "page"), reference); assertSame(reference, reference.replaceParent(reference.getParent())); }