### Question:
PdfPreviewFrame extends JFrame implements DocumentPreviewComponent { private void actionNext(ActionEvent e) { if (currentPage == pdffile.getNumPages() - 1) { return; } currentPage++; PDFPage page = pdffile.getPage(currentPage); pagePanel.showPage(page); } PdfPreviewFrame();  PdfPreviewFrame(String windowTitle); void displayComponent(); void setDocumentContent(byte[] content);  }### Answer:
@Test public void testActionNext() throws Exception{ PdfPreviewFrame previewFrame = createPartialMockForAllMethodsExcept(PdfPreviewFrame.class, "actionNext"); PDFFile pdfFile=createNiceMock(PDFFile.class); Whitebox.setInternalState(previewFrame, "pdffile", pdfFile); int currentPage=0; Whitebox.setInternalState(previewFrame, "currentPage", currentPage); PDFPage pdfPage=createNiceMock(PDFPage.class); PagePanel pagePanel=createNiceMock(PagePanel.class); Whitebox.setInternalState(previewFrame, "pagePanel", pagePanel); ActionEvent actionEvent=createNiceMock(ActionEvent.class); pdfFile.getNumPages(); expectLastCall().andReturn(2); pdfFile.getPage(1); expectLastCall().andReturn(pdfPage); pagePanel.showPage(pdfPage); expectLastCall(); replayAll(); Whitebox.invokeMethod(previewFrame, "actionNext", actionEvent); verifyAll(); currentPage=((Integer)Whitebox.getInternalState(previewFrame, "currentPage")).intValue(); assertEquals(1, currentPage); }