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