|
@@ -2,12 +2,15 @@ package net.ranides.assira.io.uri;
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
+import net.ranides.assira.io.IOStreams;
|
|
|
import net.ranides.assira.io.uri.impl.CDataHandler;
|
|
import net.ranides.assira.io.uri.impl.CDataHandler;
|
|
|
|
|
+import net.ranides.assira.text.FormatHex;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.net.URISyntaxException;
|
|
import java.net.URISyntaxException;
|
|
|
|
|
|
|
|
-import static org.junit.Assert.*;
|
|
|
|
|
|
|
+import static org.junit.Assert.assertArrayEquals;
|
|
|
|
|
+import static org.junit.Assert.assertEquals;
|
|
|
|
|
|
|
|
public class CDataHandlerTest {
|
|
public class CDataHandlerTest {
|
|
|
|
|
|
|
@@ -26,4 +29,13 @@ public class CDataHandlerTest {
|
|
|
assertEquals("źrebię na łące skacze po łące", handle4.content());
|
|
assertEquals("źrebię na łące skacze po łące", handle4.content());
|
|
|
assertEquals("Ύ π ξ", handle5.content());
|
|
assertEquals("Ύ π ξ", handle5.content());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void testData() throws IOException, URISyntaxException {
|
|
|
|
|
+ URIHandle handle1 = new CDataHandler().resolve("data:application/octet-stream;base64,QkNERXGRoMDe");
|
|
|
|
|
+
|
|
|
|
|
+ byte[] expected = FormatHex.parse("42 43 44 45 71 91 a0 c0 de");
|
|
|
|
|
+ byte[] binary = IOStreams.read(handle1.istream());
|
|
|
|
|
+ assertArrayEquals(expected, binary);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|