### Question:
StreamDocument extends CommonDocument { @Override public InputStream openStream() throws DSSException { try { return getTemporaryFileAsStream(); } catch (FileNotFoundException e) { logger.error(e.getMessage()); throw new DSSException(e); } } StreamDocument(InputStream stream, String documentName, MimeType mimeType); @Override InputStream openStream(); @Override void setName(String s); @Override String getAbsolutePath(); @Override MimeType getMimeType(); @Override void setMimeType(MimeType mimeType); @Override void save(String filePath); @Override String getDigest(DigestAlgorithm digestAlgorithm);  }### Answer:
@Test public void openStream() throws Exception { Assert.assertEquals(65, this.document.openStream().read()); }
@Test(expected = DSSException.class) public void constructorThrowsException() throws Exception { InputStream stream = new InputStream() { @Override public int read() throws IOException { throw new IOException(); } }; this.document = new StreamDocument(stream, "suur_a.txt", MimeType.TEXT); stream.close(); this.document.openStream(); }
@Test(expected = DSSException.class) public void testGetBytesThrowsException() throws Exception { new MockStreamDocument().openStream(); }
@Test(expected = DSSException.class) public void testOpenStreamThrowsException() throws Exception { new MockStreamDocument().openStream(); }