new UrlReference("unknownProt://test.example.org/some.resource");
}
@Test
public void testUrlReference() throws IOException{
ContentReference ref = new UrlReference(testURL);
assertNotNull(ref);
assertEquals(ref.getReference(), testURL.toString());
ContentSource source = ref.dereference();
assertNotNull(source);
String content = IOUtils.toString(source.getStream(), "UTF-8");
assertNotNull(content);
assertEquals(TEST_RESOURCE_CONTENT, content);
//same as above, but by using ContentSource.getData() instead of
//ContentSource.getStream()
ref = new UrlReference(testURL);
assertNotNull(ref);
assertEquals(ref.getReference(), testURL.toString());
source = ref.dereference();
assertNotNull(source);
content = new String(source.getData(),"UTF-8");
assertNotNull(content);
assertEquals(TEST_RESOURCE_CONTENT, content);
//test the constructor that takes a String
ref = new UrlReference(testURL.toString());
assertNotNull(ref);
assertEquals(ref.getReference(), testURL.toString());
source = ref.dereference();
assertNotNull(source);
content = IOUtils.toString(source.getStream(), "UTF-8");
assertNotNull(content);
assertEquals(TEST_RESOURCE_CONTENT, content);
}