@Test public void multiplePages() { PDDocument document = mock(PDDocument.class); PDPage page1 = mock(PDPage.class); when(page1.getRotation()).thenReturn(180); when(document.getPage(0)).thenReturn(page1); PDPage page2 = mock(PDPage.class); when(page2.getRotation()).thenReturn(90); when(document.getPage(1)).thenReturn(page2); when(document.getNumberOfPages()).thenReturn(2); PdfRotator victim = new PdfRotator(document); new HashSet<>(Arrays.asList(1, 2)).forEach(page -> victim.rotate(page, Rotation.DEGREES_270)); verify(page1).setRotation(90); verify(page2).setRotation(0); }
public void rotate(int pageNumber, Rotation rotation) { LOG.debug("Applying rotation of {} degrees to page {}", rotation.getDegrees(), pageNumber); PDPage page = document.getPage(pageNumber - 1); rotate(page, rotation); }
PdfRotator { public void rotate(int pageNumber, Rotation rotation) { LOG.debug("Applying rotation of {} degrees to page {}", rotation.getDegrees(), pageNumber); PDPage page = document.getPage(pageNumber - 1); rotate(page, rotation); } }
PdfRotator { public void rotate(int pageNumber, Rotation rotation) { LOG.debug("Applying rotation of {} degrees to page {}", rotation.getDegrees(), pageNumber); PDPage page = document.getPage(pageNumber - 1); rotate(page, rotation); } PdfRotator(PDDocument document); }
PdfRotator { public void rotate(int pageNumber, Rotation rotation) { LOG.debug("Applying rotation of {} degrees to page {}", rotation.getDegrees(), pageNumber); PDPage page = document.getPage(pageNumber - 1); rotate(page, rotation); } PdfRotator(PDDocument document); void rotate(int pageNumber, Rotation rotation); static void rotate(PDPage page, Rotation rotation); }
PdfRotator { public void rotate(int pageNumber, Rotation rotation) { LOG.debug("Applying rotation of {} degrees to page {}", rotation.getDegrees(), pageNumber); PDPage page = document.getPage(pageNumber - 1); rotate(page, rotation); } PdfRotator(PDDocument document); void rotate(int pageNumber, Rotation rotation); static void rotate(PDPage page, Rotation rotation);  }