java.lang.Object
org.sejda.tests.TestUtils
Test utilities
- Author:
- Andrea Vacondio
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertDocTextExactLines(org.sejda.sambox.pdmodel.PDDocument doc, String text) static voidassertInvalidParameters(TaskParameters parameters) static voidassertPageDestination(org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationLink link, org.sejda.sambox.pdmodel.PDPage expectedPage) static voidassertPageLabelIndexesAre(org.sejda.sambox.pdmodel.common.PDPageLabels labels, Integer... expected) static voidassertPageLabelRangeIs(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage, String style) static voidassertPageLabelRangeIs(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage, String style, String prefix, Integer start) static voidassertPageLabelRangeIs(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage, org.sejda.sambox.pdmodel.common.PDPageLabelRange expected) static voidassertPageLabelRangeIsDefault(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage) static voidassertPageText(org.sejda.sambox.pdmodel.PDPage page, String text) static voidassertPageTextContains(org.sejda.sambox.pdmodel.PDPage page, String text) static voidassertPageTextDoesNotContain(org.sejda.sambox.pdmodel.PDPage page, String text) static voidassertPageTextExact(org.sejda.sambox.pdmodel.PDPage page, String text) static voidassertPageTextExactLines(org.sejda.sambox.pdmodel.PDPage page, String text) static voidassertPDRectanglesEqual(org.sejda.sambox.pdmodel.common.PDRectangle expected, org.sejda.sambox.pdmodel.common.PDRectangle actual) static voidassertValidParameters(TaskParameters parameters) static PdfStreamSourcecustomEncryptedInput(String path, String password) static PdfStreamSourcecustomInput(String path) static PdfStreamSourcecustomInput(String path, String name) static PdfFileSourcecustomInput(org.sejda.sambox.pdmodel.PDDocument doc, String name) static PdfFileSourcestatic PdfFileSourcecustomInputAsFileSource(String path, String filename) static FileSourcecustomNonPdfInput(String path) static FileSourcecustomNonPdfInput(String path, String filename) static FileSourcestatic FileSourcecustomNonPdfInputAsFileSource(String path, String filename) static StreamSourcestatic StreamSourcecustomNonPdfInputAsStreamSource(String path, String filename) static FileSourceencryptedAtRest(FileSource source) static PdfFileSourceencryptedAtRest(PdfFileSource source) static PdfStreamSourceencryptedAtRest(PdfStreamSource source) static StreamSourceencryptedAtRest(StreamSource source) static PdfStreamSourcestatic PdfStreamSourcestatic <T> List<T>getAnnotationsOf(org.sejda.sambox.pdmodel.PDPage page, Class<T> clazz) static Cipherstatic StringgetDocTextNormalized(org.sejda.sambox.pdmodel.PDDocument doc) static EncryptionAtRestPolicystatic StringgetPageText(org.sejda.sambox.pdmodel.PDPage page) static StringgetPageTextNormalized(org.sejda.sambox.pdmodel.PDPage page) static <T> List<T>iteratorToList(Iterator<T> iterator) static PdfStreamSourcestatic PdfStreamSourcestatic PdfStreamSourcestatic PdfStreamSourcestatic voidsetProperty(Object instance, String propertyName, Object propertyValue) Sets the given property to the given instance at the given value.static PdfStreamSourcestatic FilestreamToTmpFile(InputStream in, String filename) static PdfStreamSourcestatic <T> voidtestEqualsAndHashCodes(T eq1, T eq2, T eq3, T diff) Test that the equals and hashCode implementations respect the general rules being reflexive, transitive and symmetric.static voidwithPageText(org.sejda.sambox.pdmodel.PDPage page, Consumer<String> callback)
-
Method Details
-
setProperty
Sets the given property to the given instance at the given value.- Parameters:
instance-propertyName-propertyValue-
-
assertInvalidParameters
-
assertValidParameters
-
testEqualsAndHashCodes
public static <T> void testEqualsAndHashCodes(T eq1, T eq2, T eq3, T diff) Test that the equals and hashCode implementations respect the general rules being reflexive, transitive and symmetric.- Type Parameters:
T-- Parameters:
eq1- equal instanceeq2- equal instanceeq3- equal instancediff- not equal instance
-
getEncryptionAtRestPolicy
-
encryptedAtRest
- Throws:
IOException
-
encryptedAtRest
- Throws:
IOException
-
encryptedAtRest
- Throws:
IOException
-
encryptedAtRest
- Throws:
IOException
-
getPageText
- Throws:
IOException
-
withPageText
-
getPageTextNormalized
- Throws:
IOException
-
getDocTextNormalized
public static String getDocTextNormalized(org.sejda.sambox.pdmodel.PDDocument doc) throws IOException - Throws:
IOException
-
assertPageText
-
assertPageTextExact
-
assertPageTextExactLines
-
assertDocTextExactLines
public static void assertDocTextExactLines(org.sejda.sambox.pdmodel.PDDocument doc, String text) throws IOException - Throws:
IOException
-
assertPageTextContains
-
assertPageTextDoesNotContain
-
getAnnotationsOf
-
iteratorToList
-
assertPDRectanglesEqual
public static void assertPDRectanglesEqual(org.sejda.sambox.pdmodel.common.PDRectangle expected, org.sejda.sambox.pdmodel.common.PDRectangle actual) -
assertPageDestination
public static void assertPageDestination(org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationLink link, org.sejda.sambox.pdmodel.PDPage expectedPage) throws IOException - Throws:
IOException
-
assertPageLabelIndexesAre
public static void assertPageLabelIndexesAre(org.sejda.sambox.pdmodel.common.PDPageLabels labels, Integer... expected) -
assertPageLabelRangeIs
public static void assertPageLabelRangeIs(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage, org.sejda.sambox.pdmodel.common.PDPageLabelRange expected) -
assertPageLabelRangeIsDefault
public static void assertPageLabelRangeIsDefault(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage) -
assertPageLabelRangeIs
public static void assertPageLabelRangeIs(org.sejda.sambox.pdmodel.common.PDPageLabels labels, int startPage, String style) -
assertPageLabelRangeIs
-
getCipher
-
shortInput
-
regularInput
-
mediumInput
-
largeInput
-
largeOutlineInput
-
encryptedInput
-
formInput
-
stronglyEncryptedInput
-
customInput
-
customInput
-
customInputAsFileSource
-
customInputAsFileSource
-
customInput
-
customEncryptedInput
-
customNonPdfInputAsStreamSource
-
customNonPdfInput
-
customNonPdfInput
-
customNonPdfInputAsStreamSource
-
customNonPdfInputAsFileSource
-
customNonPdfInputAsFileSource
-
streamToTmpFile
-