com.pdfunit.validators

## Class JavaScriptValidator

- java.lang.Object
- - com.pdfunit.validators.AbstractValidator
  - - com.pdfunit.validators.JavaScriptValidator

-     @DoNotObfuscate
      public final class JavaScriptValidator
      extends com.pdfunit.validators.AbstractValidator

  Validator for JavaScript in PDF documents.
  Since:
    2016.05
  Author:
    Carsten Siedentop, March 2016

- - ### Field Summary

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

      `testDocument`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JavaScriptValidator(DocumentValidator backReference)` Creating a validator for a JavaScript that is associated to a field of an PDF formular.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JavaScriptValidator` | `containing(java.lang.String expectedJS)` This method looks whether the JavaScript inside the current PDF-document contains the string, given by the parameter.
    `JavaScriptValidator` | `equalsTo(java.lang.String expectedContent)` This function compares the content given by the parameter with the JavaScript inside the current PDF-document.
    `JavaScriptValidator` | `equalsToSource(java.io.InputStream expectedJS)` This method reads the input given by the parameter and compares the content to the JavaScript inside the current PDF document.
    `JavaScriptValidator` | `equalsToSource(java.io.Reader expectedJS)` This method reads the input given by the parameter and compares the content to the JavaScript inside the current PDF document.
    `JavaScriptValidator` | `equalsToSource(java.lang.String fileName)` This method reads the file given by the parameter and compares the content to the JavaScript inside the current PDF document.
    `JavaScriptValidator` | `equalsToSourcen(java.io.File expectedJS)` This method reads the file given by the parameter and compares the content to the JavaScript inside the current PDF document.
    `JavaScriptValidator` | `hasJavaScript()` This method does what the name suggests.

    - ### 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

    - #### JavaScriptValidator

          protected JavaScriptValidator(DocumentValidator backReference)

      Creating a validator for a JavaScript that is associated to a field of an PDF formular.

  - ### Method Detail

    - #### containing

          @Guarded
          public JavaScriptValidator containing(java.lang.String expectedJS)

      This method looks whether the JavaScript inside the current PDF-document contains the string, given by the parameter. Whitespace will be ignored.

    - #### equalsToSource

          @Guarded
          public JavaScriptValidator equalsToSource(java.lang.String fileName)

      This method reads the file given by the parameter and compares the content to the JavaScript inside the current PDF document. Whitespace will be ignored.

    - #### equalsToSourcen

          @Guarded
          public JavaScriptValidator equalsToSourcen(java.io.File expectedJS)

      This method reads the file given by the parameter and compares the content to the JavaScript inside the current PDF document. Whitespace will be ignored.

    - #### equalsToSource

          @Guarded
          public JavaScriptValidator equalsToSource(java.io.Reader expectedJS)

      This method reads the input given by the parameter and compares the content to the JavaScript inside the current PDF document. Whitespace will be ignored.

    - #### equalsToSource

          @Guarded
          public JavaScriptValidator equalsToSource(java.io.InputStream expectedJS)

      This method reads the input given by the parameter and compares the content to the JavaScript inside the current PDF document. Whitespace will be ignored.

    - #### hasJavaScript

          public JavaScriptValidator hasJavaScript()

      This method does what the name suggests.

    - #### equalsTo

          @Guarded
          public JavaScriptValidator equalsTo(java.lang.String expectedContent)

      This function compares the content given by the parameter with the JavaScript inside the current PDF-document.

      The internal JavaScript and the expected JavaScript are always compared ignoring all whitespaces.

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