*/
protected abstract Blob createBlob(ContentSource source) throws IOException;
@Test
public void addingAndRetrieving() throws IOException{
ContentItem ci = createContentItem(contentSource);
assertNotNull(ci);
assertNotNull(ci.getUri());
UriRef partUri = new UriRef("http://foo/");
Date someObject = new Date();
ci.addPart(partUri, someObject);
ci.getMetadata().add(new TripleImpl(ci.getUri(), new UriRef("http://example.org/ontology#hasPart"), partUri));
ci.getMetadata().add(new TripleImpl(partUri, new UriRef("http://example.org/ontology#isPartOf"),ci.getUri()));
assertEquals(someObject, ci.getPart(partUri, Date.class));
assertEquals(someObject, ci.getPart(1, Date.class));
assertEquals(partUri, ci.getPartUri(1));
assertEquals(new UriRef(ci.getUri().getUnicodeString()+"_main"), ci.getPartUri(0));
try {
ci.getPart(2, Object.class);
assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
try {
ci.getPart(new UriRef("http://foo/nonexisting"), Object.class);
assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
try {
ci.getPartUri(2);
assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
//finally log the toString
log.info("toString: {}",ci);
}