### Question:
PdfContentImagePreprocessor { public boolean removeImagesAlphaChannel(PDDocument document) { this.document = document; imagesWereChanged = false; try { removeImagesAlphaChannelUnsafe(); return imagesWereChanged; } catch (Exception e) { return false; } }  boolean removeImagesAlphaChannel(PDDocument document);  }### Answer:
@Test public void testPdfNonAlphaImageReplacing() throws Exception { InputStream stream = AlterPDFParserTest.class.getResourceAsStream("/test-documents/scanned.pdf"); PDDocument doc = PDDocument.load(stream); PdfContentImagePreprocessor preproc = new PdfContentImagePreprocessor(); boolean hasReplaced = preproc.removeImagesAlphaChannel(doc); assertFalse(hasReplaced); }
@Test public void testPdfAlphaImageReplacing() throws Exception { InputStream stream = AlterPDFParserTest.class.getResourceAsStream("/test-documents/transp_scanned.pdf"); PDDocument doc = PDDocument.load(stream); PdfContentImagePreprocessor preproc = new PdfContentImagePreprocessor(); boolean hasReplaced = preproc.removeImagesAlphaChannel(doc); assertTrue(hasReplaced); }