Class ITextTest

java.lang.Object
com.itextpdf.test.ITextTest
Direct Known Subclasses:
ExtendedITextTest

public abstract class ITextTest extends Object
This is a generic class for testing. Subclassing it, or its subclasses is considered a good practice of creating your own tests.
  • Field Details

    • testTimeout

      public org.junit.rules.Timeout testTimeout
  • Constructor Details

    • ITextTest

      public ITextTest()
  • Method Details

    • createDestinationFolder

      public static void createDestinationFolder (String path)
      Creates a folder with a given path, including all necessary nonexistent parent directories. If a folder is already present, no action is performed.
      Parameters:
      path - the path of the folder to create
    • createOrClearDestinationFolder

      public static void createOrClearDestinationFolder (String path)
      Creates a directory with given path if it does not exist and clears the contents of the directory in case it exists.
      Parameters:
      path - the path of the directory to be created/cleared
    • deleteDirectory

      public static void deleteDirectory (String path)
      Removes the directory with given path along with its content including all the subdirectories.
      Parameters:
      path - the path of the directory to be removed
    • removeCryptographyRestrictions

      public static void removeCryptographyRestrictions()
      Due to import control restrictions by the governments of a few countries, the encryption libraries shipped by default with the Java SDK restrict the length, and as a result the strength, of encryption keys. Be aware that by using this method we remove cryptography restrictions via reflection for testing purposes. For more conventional way of solving this problem you need to replace the default security JARs in your Java installation with the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. These JARs are available for download from http://java.oracle.com/ in eligible countries.
    • restoreCryptographyRestrictions

      public static void restoreCryptographyRestrictions()
      By using this method we restore cryptography restrictions via reflection. This method is opposite to removeCryptographyRestrictions().
    • printOutCmpPdfNameAndDir

      public static void printOutCmpPdfNameAndDir (String out, String cmp)
    • printOutputPdfNameAndDir

      public static void printOutputPdfNameAndDir (String pdfName)
    • printPathToConsole

      public static void printPathToConsole (String path, String comment)
    • getTestTimeout

      protected org.junit.rules.Timeout getTestTimeout()
    • readFile

      protected byte[] readFile (String filename) throws IOException
      Throws:
      IOException
    • createStringByEscaped

      protected String createStringByEscaped (byte[] bytes)