use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class ExplicitReferenceEntityReferenceResolverTest method testResolveWithIncompleteExplicitReference.
@Test
public void testResolveWithIncompleteExplicitReference() {
try {
this.resolver.resolve(null, EntityType.DOCUMENT, new EntityReference("wiki", EntityType.WIKI));
Assert.fail("Should have raised an exception");
} catch (IllegalArgumentException expected) {
Assert.assertEquals("The resolver parameter doesn't contain an Entity Reference of type [DOCUMENT]", expected.getMessage());
}
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class ExplicitStringEntityReferenceResolverTest method resolveWithExplicitEntityReference.
@Test
public void resolveWithExplicitEntityReference() {
EntityReference reference = this.resolver.resolve("space.page", EntityType.DOCUMENT, new EntityReference("wiki", EntityType.WIKI));
Assert.assertEquals("page", reference.getName());
Assert.assertEquals(EntityType.DOCUMENT, reference.getType());
Assert.assertEquals("space", reference.getParent().getName());
Assert.assertEquals(EntityType.SPACE, reference.getParent().getType());
Assert.assertEquals("wiki", reference.getParent().getParent().getName());
Assert.assertEquals(EntityType.WIKI, reference.getParent().getParent().getType());
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class ExplicitStringEntityReferenceResolverTest method resolveWithExplicitReferenceWithHoles.
@Test
public void resolveWithExplicitReferenceWithHoles() {
EntityReference reference = this.resolver.resolve("space.page", EntityType.DOCUMENT, new EntityReference("page", EntityType.DOCUMENT, new EntityReference("wiki", EntityType.WIKI)));
Assert.assertEquals("page", reference.getName());
Assert.assertEquals(EntityType.DOCUMENT, reference.getType());
Assert.assertEquals("space", reference.getParent().getName());
Assert.assertEquals(EntityType.SPACE, reference.getParent().getType());
Assert.assertEquals("wiki", reference.getParent().getParent().getName());
Assert.assertEquals(EntityType.WIKI, reference.getParent().getParent().getType());
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class ExplicitStringEntityReferenceResolverTest method resolveWithExplicitDocumentReference.
@Test
public void resolveWithExplicitDocumentReference() {
EntityReference reference = this.resolver.resolve("", EntityType.DOCUMENT, new DocumentReference("wiki", "space", "page"));
Assert.assertEquals("page", reference.getName());
Assert.assertEquals(EntityType.DOCUMENT, reference.getType());
Assert.assertEquals("space", reference.getParent().getName());
Assert.assertEquals(EntityType.SPACE, reference.getParent().getType());
Assert.assertEquals("wiki", reference.getParent().getParent().getName());
Assert.assertEquals(EntityType.WIKI, reference.getParent().getParent().getType());
}
use of org.xwiki.model.reference.EntityReference in project xwiki-platform by xwiki.
the class LocalStringEntityReferenceSerializerTest method serializeDocumentReference.
@Test
public void serializeDocumentReference() throws Exception {
EntityReference reference = resolver.resolve("wiki:space.page", EntityType.DOCUMENT);
Assert.assertEquals("space.page", serializer.serialize(reference));
}
Aggregations