Modifier | Constructor and Description |
---|---|
protected |
SingleFieldValidator(com.pdfunit.internal.spi.IDocument pdfDocument)
Creating a validator for a single field of an acro form in PDF documents.
|
Modifier and Type | Method and Description |
---|---|
SingleFieldValidator |
containing(java.lang.String expectedContent)
Validating that the content of the current field contains the value given by the parameter.
|
SingleFieldValidator |
endingWith(java.lang.String expectedEnd)
Validating that the content of the current field ends with the value given by the parameter.
|
SingleFieldValidator |
hasField(java.lang.String expectedFieldName)
Verify that a field with the given name exists.
|
SingleFieldValidator |
havingJavaScriptAction(java.lang.String expectedActionName)
Looking for the name of a JavaScript action wich is bound to a field.
|
SingleFieldValidator |
matchingComplete(java.lang.String expectedValue)
Validating that the content of the current field is equal to the given parameter.
|
SingleFieldValidator |
matchingRegex(java.lang.String regex)
Validating that the content of the current field matches the regular expression.
|
SingleFieldValidator |
notContaining(java.lang.String notExpectedContent)
Validating that the content of the current field does NOT contain the value given by the parameter.
|
SingleFieldValidator |
notMatchingRegex(java.lang.String regex)
Validating that the content of the current field does not match the regular expression.
|
SingleFieldValidator |
startingWith(java.lang.String expectedStart)
Validating that the content of the current field starts with the value given by the parameter.
|
SingleFieldValidator |
whichHasMultipleLines()
This method does what the name suggests.
|
SingleFieldValidator |
whichHasSingleLine()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsEditable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsExportable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsHidden()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsMultiSelectable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotEditable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotExportable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotHidden()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotMultiSelectable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotPrintable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotReadOnly()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotRequired()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsNotVisible()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsPasswordProtected()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsPrintable()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsReadOnly()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsRequired()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsSigned()
This method does what the name suggests.
|
SingleFieldValidator |
whichIsVisible()
This method does what the name suggests.
|
SingleFieldValidator |
withAnyValue()
Validating that the content of the current field is not empty.
|
SingleFieldValidator |
withHeight(double expectedHeight,
FormatUnit unit)
This method verifies that the current field has the height equals to the given parameter.
|
SingleFieldValidator |
withHeight(int expectedHeight)
This method verifies that the current field has the height equals to the given parameter.
|
SingleFieldValidator |
withoutTextOverflow()
This method validates that the content of the current field fits inside
the size of the field.
|
SingleFieldValidator |
withType(FieldType expectedType)
This method checks the type of the current field.
|
SingleFieldValidator |
withWidth(double expectedWidth,
FormatUnit unit)
This method verifies that the current field has the width equals to the given parameter.
|
SingleFieldValidator |
withWidth(int expectedWidth)
This method verifies that the current field has the width equals to the given parameter.
|
protected SingleFieldValidator(com.pdfunit.internal.spi.IDocument pdfDocument)
@Guarded public SingleFieldValidator hasField(java.lang.String expectedFieldName)
@Guarded public SingleFieldValidator matchingComplete(java.lang.String expectedValue)
@Guarded public SingleFieldValidator containing(java.lang.String expectedContent)
@Guarded public SingleFieldValidator notContaining(java.lang.String notExpectedContent)
@Guarded public SingleFieldValidator startingWith(java.lang.String expectedStart)
@Guarded public SingleFieldValidator endingWith(java.lang.String expectedEnd)
public SingleFieldValidator withAnyValue()
@Guarded public SingleFieldValidator matchingRegex(java.lang.String regex)
@Guarded public SingleFieldValidator notMatchingRegex(java.lang.String regex)
@Guarded public SingleFieldValidator havingJavaScriptAction(java.lang.String expectedActionName)
Example
String functionForAgeFiled = "var ageField = this.getField('ageField');" + "ageField.setAction('Validate','checkAge()');" + "" + "function checkAge() {" + " if(event.value < 12) {" + " app.alert('Warning! Applicant\\'s age can not be younger than 12.');" + " event.value = 12;" + " }" + "}" ;
This test-function will be successful when starting PDFUnit in the following way:
String fieldname = "ageField"; String actionName = "Validate"; AssertThat.document(filename) .hasField(fieldname) .havingJavaScriptAction(actionName); ;
public SingleFieldValidator whichIsPasswordProtected()
public SingleFieldValidator whichIsReadOnly()
public SingleFieldValidator whichIsNotReadOnly()
public SingleFieldValidator whichIsRequired()
public SingleFieldValidator whichIsNotRequired()
public SingleFieldValidator whichIsVisible()
public SingleFieldValidator whichIsNotVisible()
public SingleFieldValidator whichIsEditable()
public SingleFieldValidator whichIsNotEditable()
public SingleFieldValidator whichHasMultipleLines()
public SingleFieldValidator whichHasSingleLine()
public SingleFieldValidator whichIsMultiSelectable()
public SingleFieldValidator whichIsNotMultiSelectable()
public SingleFieldValidator whichIsExportable()
public SingleFieldValidator whichIsNotExportable()
public SingleFieldValidator whichIsPrintable()
public SingleFieldValidator whichIsNotPrintable()
public SingleFieldValidator whichIsHidden()
public SingleFieldValidator whichIsNotHidden()
public SingleFieldValidator whichIsSigned()
@Guarded public SingleFieldValidator withWidth(int expectedWidth)
@Guarded public SingleFieldValidator withHeight(int expectedHeight)
FormatUnit
@Guarded public SingleFieldValidator withWidth(double expectedWidth, FormatUnit unit)
FormatUnit
@Guarded public SingleFieldValidator withHeight(double expectedHeight, FormatUnit unit)
FormatUnit
@Guarded public SingleFieldValidator withType(FieldType expectedType)
FieldType
public SingleFieldValidator withoutTextOverflow()
Only fields of type "button" and "text" are checked, no "choice" and no "sig". Also password fields are not checked.
Copyright (C) PDFUnit.com. See here for license.