Ranides Atterwim 4 jaren geleden
bovenliggende
commit
458dc6bb1b
1 gewijzigde bestanden met toevoegingen van 13 en 1 verwijderingen
  1. 13 1
      assira.core/src/test/java/net/ranides/assira/io/uri/CDataHandlerTest.java

+ 13 - 1
assira.core/src/test/java/net/ranides/assira/io/uri/CDataHandlerTest.java

@@ -2,12 +2,15 @@ package net.ranides.assira.io.uri;
 
 import org.junit.Test;
 
+import net.ranides.assira.io.IOStreams;
 import net.ranides.assira.io.uri.impl.CDataHandler;
+import net.ranides.assira.text.FormatHex;
 
 import java.io.IOException;
 import java.net.URISyntaxException;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
 
 public class CDataHandlerTest {
 
@@ -26,4 +29,13 @@ public class CDataHandlerTest {
         assertEquals("źrebię na łące skacze po łące", handle4.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);
+    }
 }