com.pdfunit.validators

## Class TextValidator

- java.lang.Object
- - com.pdfunit.validators.AbstractValidator
  - - com.pdfunit.validators.AbstractPageValidator
    - - com.pdfunit.validators.TextValidator

-     @DoNotObfuscate
      public final class TextValidator
      extends com.pdfunit.validators.AbstractPageValidator

  Validator for content of a PDF page in PDF documents.
  Since:
    2016.05
  Author:
    Carsten Siedentop, January 2016

- - ### Field Summary

    - ### Fields inherited from class com.pdfunit.validators.AbstractPageValidator

      `effectedPageNumbers, pageScanFlag, pagesToUse, region`

    - ### Fields inherited from class com.pdfunit.validators.AbstractValidator

      `testDocument`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TextValidator(DocumentValidator documentValidator)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `TextValidator` | `containing(java.lang.String... expectedTokens)` This method verifies that the text on every page in effect contains all given arguments.
    `TextValidator` | `containing(java.lang.String expectedToken)` This method verifies that the text on every page in effect contains the given argument.
    `TextValidator` | `containing(java.lang.String[] expectedTokens, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page, which is selected by the test, contains all given arguments.
    `TextValidator` | `containing(java.lang.String expectedToken, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect contains given arguments.
    `TextValidator` | `containingZugferdData(XMLNode node)` This method verifies that the text of previously defined pages and regions contains that text, which is extracted from the ZUGFeRD data from that node, which is defined by the given parameter.
    `TextValidator` | `endingWith(java.lang.String expectedEnd)` This method verifies that the text on every page in effect ends with the given parameter.
    `TextValidator` | `endingWith(java.lang.String expectedEnd, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect ends with the given parameter.
    `TextValidator` | `equalsTo(java.lang.String expected)` This method verifies that the text on every page in effect is equals to the expected value.
    `TextValidator` | `equalsTo(java.lang.String expected, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect is equals to the expected value.
    `OrderedTextValidator` | `first(java.lang.String expectedToken)` This methods checks that the actual text contains the expected token.
    `OrderedTextValidator` | `first(java.lang.String expectedToken, WhitespaceProcessing whitespaceProcessing)` This methods checks that the actual text contains the expected token.
    `protected java.lang.String` | `getFilteredText(int pageNumber)` This method is invoked by other validator classes.
    `boolean` | `hasNoText()` This method ensures that the previously selected pages or regions do not contain text.
    `TextValidator` | `hasText()` This method verifies that the previously selected pages or regions contain text.
    `TextValidator` | `inOrder(java.lang.String... expectedTokens)` This method verifies, that the existing text of the current PDF document contains all the expected tokens in order.
    `TextValidator` | `inOrder(WhitespaceProcessing whitespaceProcessing, java.lang.String... expectedTokens)` This method verifies, that the existing text of the current PDF document contains all the expected tokens in order.
    `TextValidator` | `matchingComplete(java.lang.String expected)` Deprecated.
    `TextValidator` | `matchingComplete(java.lang.String expected, WhitespaceProcessing whitespaceProcessing)` Deprecated.
    `TextValidator` | `matchingRegex(java.lang.String regex)` This method verifies that the text on every page in effect matches the regular expression given by the parameter.
    `TextValidator` | `notContaining(java.lang.String... notExpectedTokens)` This method verifies that the text on every page in effect does not contain the string given by the parameter.
    `TextValidator` | `notContaining(java.lang.String notExpectedToken)` This method verifies that the text on every page in effect does not contain the string given by the parameter.
    `TextValidator` | `notContaining(java.lang.String[] notExpectedTokens, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect does not contain the string given by the parameter.
    `TextValidator` | `notContaining(java.lang.String notExpectedToken, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect does not contain the string given by the parameter.
    `TextValidator` | `notEndingWith(java.lang.String notExpectedEnd)` This method verifies that the text on every page in effect does not end with the given parameter.
    `TextValidator` | `notMatchingRegex(java.lang.String regex)` This method verifies that the text on every page in effect does not match the regular expression given by the parameter.
    `TextValidator` | `notStartingWith(java.lang.String notExpectedStart)` This method verifies that the text on every page in effect does not start with the given parameter.
    `TextValidator` | `startingWith(java.lang.String expectedStart)` This method verifies that the text on every page in effect starts with the given parameter.
    `TextValidator` | `startingWith(java.lang.String expectedStart, WhitespaceProcessing whitespaceProcessing)` This method verifies that the text on every page in effect starts with the given parameter.

    - ### Methods inherited from class com.pdfunit.validators.AbstractPageValidator

      `createFullSizeRegionFromDocument, getEffectedPages, getPageScanFlag, setPagesToUse, setRegion`

    - ### Methods inherited from class com.pdfunit.validators.AbstractValidator

      `closeDocument, equals, getDocument, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextValidator

          protected TextValidator(DocumentValidator documentValidator)

  - ### Method Detail

    - #### containing

          @Guarded
          public TextValidator containing(java.lang.String expectedToken)

      This method verifies that the text on every page in effect contains the given argument. Whitespaces are stripped before.

    - #### containing

          @Guarded
          public TextValidator containing(java.lang.String expectedToken,
                                         WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect contains given arguments. Whitespaces are stripped before.

    - #### containing

          @Guarded
          public TextValidator containing(java.lang.String... expectedTokens)

      This method verifies that the text on every page in effect contains all given arguments. Whitespaces are stripped before.

    - #### containing

          @Guarded
          public TextValidator containing(java.lang.String[] expectedTokens,
                                         WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page, which is selected by the test, contains all given arguments. Whitespaces are stripped before.

    - #### containingZugferdData

          @Guarded
          public TextValidator containingZugferdData(XMLNode node)

      This method verifies that the text of previously defined pages and regions contains that text, which is extracted from the ZUGFeRD data from that node, which is defined by the given parameter.

      All whitespaces will be ignored.

    - #### first

          @Guarded
          public OrderedTextValidator first(java.lang.String expectedToken)

      This methods checks that the actual text contains the expected token. The position of the match was saved for subsequent position dependent checks.

      Whitespace of the existing text and of the expected text will be normalized.

    - #### first

          @Guarded
          public OrderedTextValidator first(java.lang.String expectedToken,
                                           WhitespaceProcessing whitespaceProcessing)

      This methods checks that the actual text contains the expected token. The position of the match was saved for subsequent position dependent checks.

      Whitespace of the existing text and of the expected text will be processed according to the second parameter.

    - #### endingWith

          @Guarded
          public TextValidator endingWith(java.lang.String expectedEnd)

      This method verifies that the text on every page in effect ends with the given parameter. Whitespaces are stripped before.

    - #### endingWith

          @Guarded
          public TextValidator endingWith(java.lang.String expectedEnd,
                                         WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect ends with the given parameter. The whitespace processing is handled first.

    - #### equalsTo

          @Guarded
          public TextValidator equalsTo(java.lang.String expected)

      This method verifies that the text on every page in effect is equals to the expected value. Whitespaces are stripped before.

    - #### equalsTo

          @Guarded
          public TextValidator equalsTo(java.lang.String expected,
                                       WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect is equals to the expected value. The whitespace processing is handled first.

    - #### getFilteredText

          protected java.lang.String getFilteredText(int pageNumber)

      This method is invoked by other validator classes.

    - #### hasNoText

          public boolean hasNoText()

      This method ensures that the previously selected pages or regions do not contain text.

      If the flag 'pageScanFlag' is set, only one page has to have no text. It's recommended, not to use negated methods in combination with `AnyPageBefore`, `AnyPageAfter`, `AnyPage`, or `PagesFromTo`. The logic is difficult.

    - #### hasText

          public TextValidator hasText()

      This method verifies that the previously selected pages or regions contain text. Whitespace does not count as text.

      If the flag 'PageScan.MATCH_ON_ANY_PAGE' is set, only one page has to have text.

      See Also:
        `PageScan`

    - #### inOrder

          @Guarded
          public TextValidator inOrder(java.lang.String... expectedTokens)

      This method verifies, that the existing text of the current PDF document contains all the expected tokens in order.

      This method can not be invoked with an empty array, because empty arrays will be rejected by the guard.

    - #### inOrder

          @Guarded
          public TextValidator inOrder(WhitespaceProcessing whitespaceProcessing,
                                      java.lang.String... expectedTokens)

      This method verifies, that the existing text of the current PDF document contains all the expected tokens in order.

      This method can not be invoked with an empty array, because empty arrays will be rejected by the guard.

    - #### matchingComplete

          @Deprecated
          @Guarded
          public TextValidator matchingComplete(java.lang.String expected)

      Deprecated.
      This method verifies that the text on every page in effect is equals to the expected value.

      The method is deprecated, use 'equalsTo()' instead. Both methods have the same behaviour but the new name is closer to the natural language.

      Whitespaces are stripped before.

    - #### matchingComplete

          @Guarded
          @Deprecated
          public TextValidator matchingComplete(java.lang.String expected,
                                                          WhitespaceProcessing whitespaceProcessing)

      Deprecated.
      This method verifies that the text on every page in effect is equals to the expected value. The whitespace processing is handled first.

      The method is deprecated, use 'equalsTo()' instead. Both methods have the same behaviour but the new name is closer to the natural language.

      See Also:
        `WhitespaceProcessing`

    - #### matchingRegex

          @Guarded
          public TextValidator matchingRegex(java.lang.String regex)

      This method verifies that the text on every page in effect matches the regular expression given by the parameter.

    - #### notContaining

          @Guarded
          public TextValidator notContaining(java.lang.String notExpectedToken)

      This method verifies that the text on every page in effect does not contain the string given by the parameter. Whitespaces are stripped before.

    - #### notContaining

          @Guarded
          public TextValidator notContaining(java.lang.String... notExpectedTokens)

      This method verifies that the text on every page in effect does not contain the string given by the parameter. Whitespaces are stripped before.

    - #### notContaining

          @Guarded
          public TextValidator notContaining(java.lang.String notExpectedToken,
                                            WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect does not contain the string given by the parameter. Whitespaces are stripped before.
      See Also:
        `WhitespaceProcessing`

    - #### notContaining

          @Guarded
          public TextValidator notContaining(java.lang.String[] notExpectedTokens,
                                            WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect does not contain the string given by the parameter. Whitespaces are stripped before.
      See Also:
        `WhitespaceProcessing`

    - #### notEndingWith

          @Guarded
          public TextValidator notEndingWith(java.lang.String notExpectedEnd)

      This method verifies that the text on every page in effect does not end with the given parameter. Whitespaces are stripped before.

    - #### notMatchingRegex

          @Guarded
          public TextValidator notMatchingRegex(java.lang.String regex)

      This method verifies that the text on every page in effect does not match the regular expression given by the parameter.

    - #### notStartingWith

          @Guarded
          public TextValidator notStartingWith(java.lang.String notExpectedStart)

      This method verifies that the text on every page in effect does not start with the given parameter. Whitespaces are stripped before.

    - #### startingWith

          @Guarded
          public TextValidator startingWith(java.lang.String expectedStart)

      This method verifies that the text on every page in effect starts with the given parameter. Whitespaces are stripped before.

    - #### startingWith

          @Guarded
          public TextValidator startingWith(java.lang.String expectedStart,
                                           WhitespaceProcessing whitespaceProcessing)

      This method verifies that the text on every page in effect starts with the given parameter. The whitespace processing is handled first.

Copyright (C) PDFUnit.com. See here for license.