/**
* Test the DataURIResolver with correct values.
* @throws Exception if an error occurs
*/
public void testDataURLHandling() throws Exception {
URIResolver resolver = new DataURIResolver();
Source src;
src = resolver.resolve("data:;base64,AAECAwQF", null);
assertNotNull(src);
StreamSource streamSource = (StreamSource)src;
byte[] data = IOUtils.toByteArray(streamSource.getInputStream());
assertTrue("Decoded data doesn't match the test data", byteCmp(TESTDATA, 0, data));
src = resolver.resolve(
"data:application/octet-stream;interpreter=fop;base64,AAECAwQF", null);
assertNotNull(src);
streamSource = (StreamSource)src;
assertNotNull(streamSource.getInputStream());
assertNull(streamSource.getReader());
data = IOUtils.toByteArray(streamSource.getInputStream());
assertTrue("Decoded data doesn't match the test data", byteCmp(TESTDATA, 0, data));
src = resolver.resolve("data:,FOP", null);
assertNotNull(src);
streamSource = (StreamSource)src;
assertNull(streamSource.getInputStream());
assertNotNull(streamSource.getReader());
String text = IOUtils.toString(streamSource.getReader());