use of org.apache.stanbol.enhancer.servicesapi.ContentItem in project stanbol by apache.
the class ContentItemFactoryTest method testContentReferenceId.
/**
* Tests if the {@link ContentReference#getReference()} is used as ID for
* the contentItem
*/
@Test
public void testContentReferenceId() throws IOException {
ContentItem ci = contentItemFactory.createContentItem(TEST_CR);
assertNotNull(ci);
assertNotNull(ci.getUri());
assertEquals(TEST_CR.getReference(), ci.getUri().getUnicodeString());
contentItemFactory.createContentItem(TEST_CR, new SimpleGraph());
assertNotNull(ci);
assertNotNull(ci.getUri());
assertEquals(TEST_CR.getReference(), ci.getUri().getUnicodeString());
}
use of org.apache.stanbol.enhancer.servicesapi.ContentItem in project stanbol by apache.
the class ContentItemFactoryTest method testPrefix.
/**
* Test that the generated ID starts with the parsed prefix
*/
@Test
public void testPrefix() throws IOException {
ContentItem ci = contentItemFactory.createContentItem(PREFIX, TEST_CS);
assertNotNull(ci);
assertNotNull(ci.getUri());
assertTrue("The ID of the created ContentItem MUST start with the parsed prefix", ci.getUri().getUnicodeString().startsWith(PREFIX));
ci = contentItemFactory.createContentItem(PREFIX, TEST_CS, new SimpleGraph());
assertNotNull(ci);
assertNotNull(ci.getUri());
assertTrue("The ID of the created ContentItem MUST start with the parsed prefix", ci.getUri().getUnicodeString().startsWith(PREFIX));
}
use of org.apache.stanbol.enhancer.servicesapi.ContentItem in project stanbol by apache.
the class ContentItemFactoryTest method testDefaultId.
/**
* Test the generation of valid IDs if no or <code>null</code> is parsed
* as id
*/
@Test
public void testDefaultId() throws IOException {
ContentItem ci = contentItemFactory.createContentItem(TEST_CS);
assertNotNull(ci);
assertNotNull(ci.getUri());
ci = contentItemFactory.createContentItem((IRI) null, TEST_CS);
assertNotNull(ci);
assertNotNull(ci.getUri());
ci = contentItemFactory.createContentItem((IRI) null, TEST_CS, new SimpleGraph());
assertNotNull(ci);
assertNotNull(ci.getUri());
}
Aggregations