### Question:
SecurityReference extends EntityReference { public DocumentReference getOriginalDocumentReference() { return (this.getType() == EntityType.DOCUMENT) ? (this.originalReference instanceof DocumentReference) ? (DocumentReference) this.originalReference : new DocumentReference(this.originalReference) : null; } SecurityReference(EntityReference reference);   SecurityReference(EntityReference reference, SecurityReference mainWiki); SecurityReference getParentSecurityReference(); Deque<SecurityReference> getReversedSecurityReferenceChain(); EntityType getSecurityType(); SecurityReference getWikiReference(); EntityReference getOriginalReference(); WikiReference getOriginalWikiReference(); SpaceReference getOriginalSpaceReference(); DocumentReference getOriginalDocumentReference(); static final EntityType FARM; }### Answer:
@Test public void testGetOriginalDocumentReference() throws Exception { assertThat(factory.newEntityReference(null).getOriginalDocumentReference(), nullValue()); assertThat(factory.newEntityReference(xwiki).getOriginalDocumentReference(), nullValue()); assertThat(factory.newEntityReference(wiki).getOriginalDocumentReference(), nullValue()); assertThat(factory.newEntityReference(xspace).getOriginalDocumentReference(), nullValue()); assertThat(factory.newEntityReference(space).getOriginalDocumentReference(), nullValue()); assertThat(factory.newEntityReference(mainEntity).getOriginalDocumentReference(), equalTo(mainEntity)); assertThat(factory.newEntityReference(subEntity).getOriginalDocumentReference(), equalTo(subEntity)); }