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