### Question:
PdfRotationInput implements PagesSelection { @Override public Set<Integer> getPages(int totalNumberOfPage) { Set<Integer> retSet = new NullSafeSet<>(); for (PagesSelection selection : pageSelection) { retSet.addAll(selection.getPages(totalNumberOfPage)); } return retSet; } PdfRotationInput(PdfSource<?> source, Rotation rotation, PagesSelection... pages); @Override Set<Integer> getPages(int totalNumberOfPage); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object other); @Valid
    @NotNull
    final PdfSource<?> source; @Valid
    @NotNull
    final Rotation rotation; }### Answer:
@Test public void nullPagesAllPages() { PdfRotationInput victim = new PdfRotationInput(mock(PdfSource.class), Rotation.DEGREES_180, null); Set<Integer> pages = victim.getPages(3); assertEquals(3, pages.size()); assertTrue(pages.contains(1)); assertTrue(pages.contains(2)); assertTrue(pages.contains(3)); }
@Test public void emptyPagesAllPages() { PdfRotationInput victim = new PdfRotationInput(mock(PdfSource.class), Rotation.DEGREES_180, new PagesSelection[0]); Set<Integer> pages = victim.getPages(3); assertEquals(3, pages.size()); assertTrue(pages.contains(1)); assertTrue(pages.contains(2)); assertTrue(pages.contains(3)); }
@Test public void predefinedPageSet() { PdfRotationInput victim = new PdfRotationInput(mock(PdfSource.class), Rotation.DEGREES_180, PredefinedSetOfPages.EVEN_PAGES); Set<Integer> pages = victim.getPages(3); assertEquals(1, pages.size()); assertTrue(pages.contains(2)); }
@Test public void multiplePageRanges() { PdfRotationInput victim = new PdfRotationInput(mock(PdfSource.class), Rotation.DEGREES_180, new PageRange[] { new PageRange(2, 3), new PageRange(5, 5) }); Set<Integer> pages = victim.getPages(5); assertEquals(3, pages.size()); assertTrue(pages.contains(2)); assertTrue(pages.contains(3)); assertTrue(pages.contains(5)); }