@Test public void testMultipleInputOneDoesntContainRange() throws IOException { setUpRotateMultipleInputNotRangesContained(); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertOutputSize(2); }
private void setUpRotateMultipleInputNotRangesContained() { parameters = new RotateParameters(Rotation.DEGREES_90); parameters.addPageRange(new PageRange(2, 4)); parameters.addPageRange(new PageRange(15, 15)); parameters.addSource(shortInput()); parameters.addSource(mediumInput()); parameters.setExistingOutputPolicy(ExistingOutputPolicy.OVERWRITE); }
@Test public void testVersionPrefixAndCreatorAreApplied() throws IOException { setUpParametersWithVersionPrefixAndCompressionSpecified(); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertCreator().assertPages(4).assertVersion(PdfVersion.VERSION_1_6); }
@Test public void testRotateSpecificPages() throws IOException { setUpRotateSpecificPages(); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertCreator().assertPages(4).forEachPdfOutput(d -> assertEquals(90, d.getPage(2).getRotation())); }
@Test public void testExecuteEncrypted() throws IOException { setUpParametersEncrypted(); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertCreator().assertPages(4) .forEachPdfOutput(d -> d.getPages().forEach(p -> assertEquals(180, p.getRotation()))); }
@Test public void testExecute() throws IOException { setUpDefaultParameters(); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertCreator().assertPages(4) .forEachPdfOutput(d -> d.getPages().forEach(p -> assertEquals(180, p.getRotation()))); }
@Test public void testDifferentRotations() throws IOException { parameters = new RotateParameters(); parameters.addPageRange(new PageRange(1, 2), Rotation.DEGREES_90); parameters.addPageRange(new PageRange(3, 4), Rotation.DEGREES_180); parameters.addSource(shortInput()); parameters.setExistingOutputPolicy(ExistingOutputPolicy.OVERWRITE); testContext.directoryOutputTo(parameters); execute(parameters); testContext.assertTaskCompleted(); testContext.assertCreator().assertPages(4).forEachPdfOutput(d -> { assertEquals(90, d.getPage(0).getRotation()); assertEquals(90, d.getPage(1).getRotation()); assertEquals(180, d.getPage(2).getRotation()); assertEquals(180, d.getPage(3).getRotation()); }); } }
private void setUpDefaultParameters() { parameters = new RotateParameters(Rotation.DEGREES_180, PredefinedSetOfPages.ALL_PAGES); parameters.addSource(shortInput()); parameters.setExistingOutputPolicy(ExistingOutputPolicy.OVERWRITE); }
private void setUpParametersEncrypted() { parameters = new RotateParameters(Rotation.DEGREES_180, PredefinedSetOfPages.ALL_PAGES); parameters.setExistingOutputPolicy(ExistingOutputPolicy.OVERWRITE); parameters.addSource(stronglyEncryptedInput()); }
private void setUpRotateSpecificPages() { parameters = new RotateParameters(Rotation.DEGREES_90); parameters.addPageRange(new PageRange(2, 4)); parameters.addSource(shortInput()); parameters.setExistingOutputPolicy(ExistingOutputPolicy.OVERWRITE); }
private void setUpParametersWithVersionPrefixAndCompressionSpecified() { parameters = new RotateParameters(Rotation.DEGREES_180, PredefinedSetOfPages.ALL_PAGES); parameters.setCompress(true); parameters.setOutputPrefix("test_prefix_"); parameters.setVersion(PdfVersion.VERSION_1_6); parameters.addSource(shortInput()); parameters.setExistingOutputPolicy(ExistingOutputPolicy.SKIP); }