### Question:
SecurityReference extends EntityReference { public SpaceReference getOriginalSpaceReference() { return (this.getType() == EntityType.SPACE) ? (this.originalReference instanceof SpaceReference) ? (SpaceReference) this.originalReference : new SpaceReference(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 testGetOriginalSpaceReference() throws Exception { assertThat(factory.newEntityReference(null).getOriginalSpaceReference(), nullValue()); assertThat(factory.newEntityReference(xwiki).getOriginalSpaceReference(), nullValue()); assertThat(factory.newEntityReference(wiki).getOriginalSpaceReference(), nullValue()); assertThat(factory.newEntityReference(xspace).getOriginalSpaceReference(), equalTo(xspace)); assertThat(factory.newEntityReference(space).getOriginalSpaceReference(), equalTo(space)); assertThat(factory.newEntityReference(mainEntity).getOriginalSpaceReference(), nullValue()); assertThat(factory.newEntityReference(subEntity).getOriginalSpaceReference(), nullValue()); }