### Question:
PdfPreviewFrame extends JFrame implements DocumentPreviewComponent { public void setDocumentContent(byte[] content) { File file = null; try { file = File.createTempFile("doc_", ".pdf"); OutputStream out = new FileOutputStream(file); out.write(content); out.close(); RandomAccessFile raf = new RandomAccessFile(file, "r"); FileChannel channel = raf.getChannel(); ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size()); pdffile = new PDFFile(buf); } catch (IOException e) { log.error(e); } } PdfPreviewFrame();  PdfPreviewFrame(String windowTitle); void displayComponent(); void setDocumentContent(byte[] content);  }### Answer:
@Test public void testSetDocumentContent() throws Exception { PDDocument document = new PDDocument(); ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); PDPage blankPage = new PDPage(); document.addPage(blankPage); document.save(byteOutputStream); document.close(); PdfPreviewFrame previewFrame = createPartialMockForAllMethodsExcept(PdfPreviewFrame.class, "setDocumentContent"); previewFrame.setDocumentContent(byteOutputStream.toByteArray()); Object object = Whitebox.getInternalState(previewFrame, "pdffile"); assertNotNull(object); assertTrue(object instanceof PDFFile); }