### Question:
DataFile implements Serializable { public byte[] getBytes() { try { return IOUtils.toByteArray(document.openStream()); } catch (IOException e) { throw new TechnicalException("Error reading document bytes: " + e.getMessage(), e); } } DataFile(String path, String mimeType);  DataFile(byte[] data, String fileName, String mimeType);  DataFile(InputStream stream, String fileName, String mimeType); protected  DataFile(DSSDocument document);  DataFile(); byte[] calculateDigest(); byte[] calculateDigest(URL method); byte[] calculateDigest(org.digidoc4j.DigestAlgorithm digestType); String getName(); String getId(); long getFileSize(); String getMediaType(); void setMediaType(String mediaType); void saveAs(OutputStream out); void saveAs(String path); byte[] getBytes(); InputStream getStream(); void setId(String dataFileId); DSSDocument getDocument(); void setDocument(DSSDocument document);  }### Answer:
@Test public void testGetBytes() throws Exception { DataFile dataFile = new DataFile(new byte[]{0x041}, "suura.txt", "text/plain"); Assert.assertArrayEquals(new byte[]{0x041}, dataFile.getBytes()); }
@Test(expected = DigiDoc4JException.class) public void createDocumentFromInoutStreamThrowsException() throws IOException { try (ByteArrayInputStream stream = new ByteArrayInputStream("test".getBytes())) { new DataFile(stream, "test.txt", "unknown"); } }