private void testSetupFilterList() { stream.setupFilterList(); PDFFilterList filterList = stream.getFilterList(); assertTrue(filterList.isInitialized()); assertEquals(1, filterList.getFilters().size()); PDFFilter filter = filterList.getFilters().get(0); assertEquals("/FlateDecode", filter.getName()); }
@Test public void customFilter() { PDFFilterList filters = stream.getFilterList(); filters.addFilter("null"); assertTrue(filters.isInitialized()); assertEquals(1, filters.getFilters().size()); PDFFilter filter = filters.getFilters().get(0); assertEquals("", filter.getName()); }
@Test public void testStream() throws IOException { PDFFilterList filters = stream.getFilterList(); filters.addFilter("null"); byte[] bytes = createSampleData(); stream.setData(bytes); ByteArrayOutputStream actual = new ByteArrayOutputStream(); stream.outputRawStreamData(actual); assertArrayEquals(bytes, actual.toByteArray()); }
@Test public void testEncodeAndWriteStream() throws IOException { PDFFilterList filters = stream.getFilterList(); filters.addFilter("null"); byte[] bytes = createSampleData(); stream.setData(bytes); ByteArrayOutputStream actual = new ByteArrayOutputStream(); PDFNumber number = new PDFNumber(); stream.encodeAndWriteStream(actual, number); assertArrayEquals(createSampleStreamData(), actual.toByteArray()); }
private void testGetFilterList() { PDFFilterList filterList = stream.getFilterList(); assertFalse(filterList.isInitialized()); assertEquals(0, filterList.getFilters().size()); }