### Question:
SecurityReference extends EntityReference { public SecurityReference getWikiReference() { SecurityReference result = this; while (result != null && result.getType() != EntityType.WIKI) { result = result.getParentSecurityReference(); } return result; } 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 testGetWikiReference() throws Exception { assertThat(factory.newUserReference(userRef).getWikiReference(), equalTo(xwiki)); assertThat(factory.newUserReference(anotherWikiUserRef).getWikiReference(), equalTo(wiki)); assertThat(factory.newEntityReference(mainEntity).getWikiReference(), equalTo(xwiki)); assertThat(factory.newEntityReference(subEntity).getWikiReference(), equalTo(wiki)); assertThat(factory.newEntityReference(xwiki).getWikiReference(), equalTo(xwiki)); assertThat(factory.newEntityReference(wiki).getWikiReference(), equalTo(wiki)); }