@Test
public void testExtractReference()
{

    EntityReference reference1 = new EntityReference("page", EntityType.DOCUMENT,
        new EntityReference("space", EntityType.SPACE,
            new EntityReference("wiki", EntityType.WIKI)));
    Assert.assertEquals("wiki", reference1.extractReference(EntityType.WIKI).getName());
    Assert.assertEquals("space", reference1.extractReference(EntityType.SPACE).getName());
    Assert.assertEquals("page", reference1.extractReference(EntityType.DOCUMENT).getName());
    Assert.assertNull(reference1.extractReference(EntityType.ATTACHMENT));
}