Permalink
Browse files

Tests: pdf.Stream.write() writes data to output stream.

  • Loading branch information...
eseifert committed Aug 19, 2017
1 parent c22a648 commit 19fe971c2bd3898dc59d458967a039e63825d33b
Showing with 30 additions and 1 deletion.
  1. +30 −1 src/test/java/de/erichseifert/vectorgraphics2d/pdf/StreamTest.java
@@ -22,6 +22,7 @@
package de.erichseifert.vectorgraphics2d.pdf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertThat;
import java.io.IOException;
@@ -44,8 +45,36 @@ public void testGetContentThrowsExceptionWhenStreamIsOpen() {
stream.getContent();
}
@Test
public void testWriteIntWritesDataToStream() throws IOException {
Stream stream = new Stream();
stream.write(42);
stream.close();
assertArrayEquals(new byte[] {42}, stream.getContent());
}
@Test(expected = IOException.class)
public void testWriteIntThrowsExceptionWhenStreamIsClosed() throws IOException {
Stream stream = new Stream();
stream.close();
stream.write(42);
}
@Test
public void testWriteBytesWritesDataToStream() throws IOException {
Stream stream = new Stream();
stream.write(new byte[] {42});
stream.close();
assertArrayEquals(new byte[] {42}, stream.getContent());
}
@Test(expected = IOException.class)
public void testWriteThrowsExceptionWhenStreamIsClosed() throws IOException {
public void testWriteBytesThrowsExceptionWhenStreamIsClosed() throws IOException {
Stream stream = new Stream();
stream.close();

0 comments on commit 19fe971

Please sign in to comment.