new ContentItemImpl(ciUri,blob,null){};
}
@Test
public void addingAndRetrieving() {
ContentItem ci = new ContentItemImpl(ciUri,blob,new SimpleMGraph()){};
UriRef partUri = new UriRef("http://foo/");
Date someObject = new Date();
ci.addPart(partUri, someObject);
ci.getMetadata().add(new TripleImpl(ciUri, new UriRef("http://example.org/ontology#hasPart"), partUri));
ci.getMetadata().add(new TripleImpl(partUri, new UriRef("http://example.org/ontology#isPartOf"),ciUri));
Assert.assertEquals(someObject, ci.getPart(partUri, Date.class));
Assert.assertEquals(someObject, ci.getPart(1, Date.class));
Assert.assertEquals(partUri, ci.getPartUri(1));
Assert.assertEquals(new UriRef(ciUri.getUnicodeString()+"_main"), ci.getPartUri(0));
try {
ci.getPart(2, Object.class);
Assert.assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
try {
ci.getPart(new UriRef("http://foo/nonexisting"), Object.class);
Assert.assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
try {
ci.getPartUri(2);
Assert.assertTrue("Requesting non existance part MUST throw an NoSuchPartException", false);
} catch (NoSuchPartException e) {/* expected*/}
//finally log the toString
log.info("toString: {}",ci);
}