|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.oio.jpdfunit.DocumentTester
public class DocumentTester
The PdfTesterClass is a core element of JPdfUnit. This class implements the Assertion interfaces and has a Document and a Content for working with the pdf files. The different assert methods are implemented right here.
Constructor Summary | |
---|---|
DocumentTester(InputStream fileStream)
The Constructor uses a InputStream to get the document. |
|
DocumentTester(String file)
The constructor uses a String to get the document. |
Method Summary | |
---|---|
void |
assertAllFontNamesInDocument(String[] expected)
|
void |
assertAllFontNamesOnPage(String[] expected,
int page)
|
void |
assertAllFontTypesInDocument(String[] expected)
|
void |
assertAllFontTypesOnPage(String[] expected,
int page)
|
void |
assertAuthorsNameEquals(String expected)
The method compares the supposed authors name to the authors name of the pdf document. |
void |
assertBookmarkExists(String bookmarkName)
|
void |
assertBookmarksAre(String[] bookmarks)
|
void |
assertContentContainsText(String text,
TextSearchType type)
This assert method checks if the supposed parameters are contained in the document. |
void |
assertContentContainsTextMultipleTimes(String text,
TextSearchType type)
This assert method checks if the supposed parameters are contained in the document. |
void |
assertContentContainsTextOnPage(String text,
int page,
TextSearchType type)
This assert method checks if the supposed parameters are contained in the document. |
void |
assertContentDoesNotContainText(String text,
TextSearchType type)
This assert method checks if the supposed parameters are not contained in the document. |
void |
assertContentDoesNotContainTextMultipleTimes(String text,
TextSearchType type)
This assert method checks if the supposed parameters are not contained in the document. |
void |
assertContentDoesNotContainTextOnPage(String text,
int page,
TextSearchType type)
This assert method checks if the supposed parameters are not contained in the document. |
void |
assertCreationDateEquals(Calendar expected)
The method comapares the supposed creation date to the creation date of the document. |
void |
assertCreatorEquals(String expected)
The method compares the supposed creator to the creator of the document. |
void |
assertDecryptionWithOwnerPasswd(String expected)
The method compares the supposed owner password with the owner password if it exists of the document and trys to decrypt the document. |
void |
assertDecryptionWithUserPasswd(String expected)
The method compares the supposed user password with the user password if it exists of the document and trys to decrypt the document. |
void |
assertDocumentTitleEquals(String expected)
The method comapares the supposed document title of the document informations with the document title of the document. |
void |
assertEncryptionLenghthEquals(int expected)
The method compares the supposed encryption length with the encryption length of the document if it is encrypted else it returns 0. |
void |
assertFontNameInDocumentEquals(String expected)
|
void |
assertFontNameOnPage(String expected,
int page)
|
void |
assertFontTypeInDocument(String expected)
|
void |
assertFontTypeOnPage(String expected,
int page)
|
void |
assertIsDocumentEncrypted(boolean expected)
The method checks if the current document is encrypted and comapares it to the parameter. |
void |
assertIsOwnerPasswd(String expected)
Deprecated. |
void |
assertIsUserPasswd(String expected)
Deprecated. |
void |
assertKeywordsEquals(String expected)
The method compares the supposed keywords to the keywords of the document informations of the document. |
void |
assertNumberOfBookmarks(int numberOfBookmarks)
|
void |
assertPageCountEquals(int expected)
The method compares the supposed page number to the page number of the document. |
void |
assertSubjectEquals(String expected)
The method compares the supposed subject to the subject of the document. |
void |
assertVersionEquals(float expected)
The method compares the supposed version to the version of the document. |
void |
close()
File handling you have to close the document after finishing your tests. |
Content |
getContent()
The method returns the Content of the Document. |
Document |
getDocument()
The method returns the Document of the DocumentTester. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentTester(String file)
file
- The path and the file as String. I.e.
"/home/bbratkus/test.pdf", a relative path.public DocumentTester(InputStream fileStream)
fileStream
- The Stream which the pdf file is within.Method Detail |
---|
public void assertAuthorsNameEquals(String expected)
assertAuthorsNameEquals
in interface MetaDataAssertion
expected
- The expected authors name, the methods checks if the expected
value equals the authors name of the pdf file.public void assertContentContainsText(String text, TextSearchType type)
assertContentContainsText
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertContentContainsTextOnPage(String text, int page, TextSearchType type)
assertContentContainsTextOnPage
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.page
- The supposed page to search for the text. The page count is
1-based.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertContentContainsTextMultipleTimes(String text, TextSearchType type)
assertContentContainsTextMultipleTimes
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertContentDoesNotContainText(String text, TextSearchType type)
assertContentDoesNotContainText
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertContentDoesNotContainTextOnPage(String text, int page, TextSearchType type)
assertContentDoesNotContainTextOnPage
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.page
- The supposed page to search for the text. The page count is
1-based.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertContentDoesNotContainTextMultipleTimes(String text, TextSearchType type)
assertContentDoesNotContainTextMultipleTimes
in interface ContentAssertion
text
- The text to search within the document for. Even a regular
expression is a valid parameter.type
- The TextSearchtype but remember that this is relative to the
single pages of the document.public void assertCreatorEquals(String expected)
assertCreatorEquals
in interface MetaDataAssertion
expected
- The supposed creator of the document.public void assertCreationDateEquals(Calendar expected)
assertCreationDateEquals
in interface MetaDataAssertion
expected
- The expected creation date of the document. It will be
compared to the creation date of the document.public void assertDecryptionWithOwnerPasswd(String expected)
assertDecryptionWithOwnerPasswd
in interface MetaDataAssertion
expected
- The supposed owner password. This method tries to decrypt the
pdf file with this password.public void assertDecryptionWithUserPasswd(String expected)
assertDecryptionWithUserPasswd
in interface MetaDataAssertion
expected
- The supposed user password. This method tries to decrypt the
pdf file with this password.public void assertDocumentTitleEquals(String expected)
assertDocumentTitleEquals
in interface MetaDataAssertion
expected
- The expected document title, the methods checks if the
expected value equals the document title of the pdf file.public void assertEncryptionLenghthEquals(int expected)
assertEncryptionLenghthEquals
in interface MetaDataAssertion
expected
- The expected encryption length, the method checks if the
expected value equals the encryption length of the pdf file.public void assertKeywordsEquals(String expected)
assertKeywordsEquals
in interface MetaDataAssertion
expected
- The expected keywords, the method checks if the expected
keywords equals the keywords of the pdf file.public void assertPageCountEquals(int expected)
assertPageCountEquals
in interface MetaDataAssertion
expected
- The expected page count. The method checks if the expected
page count equals the page count of the pdf file. The page
count is 1-based.public void assertSubjectEquals(String expected)
assertSubjectEquals
in interface MetaDataAssertion
expected
- The expected subject, the method checks if the expected
subject equals the subject of the pdf file.public void assertIsDocumentEncrypted(boolean expected)
assertIsDocumentEncrypted
in interface MetaDataAssertion
expected
- Expected has to be set to "true" if you suppose that the
document is encrypted.@Deprecated public void assertIsOwnerPasswd(String expected)
assertIsOwnerPasswd
in interface MetaDataAssertion
expected
- The expected owner password. The method compares the expected
owner password to the owner password of the pdf file. This is
necessary for changing the document attributes.@Deprecated public void assertIsUserPasswd(String expected)
assertIsUserPasswd
in interface MetaDataAssertion
expected
- The expected user password. The method compares the expected
user password to the user password of the pdf file. This is
necessary for reading the pdf file.public void assertVersionEquals(float expected)
assertVersionEquals
in interface MetaDataAssertion
expected
- The expected version of the pdf file. The method checks if the
expected version equals the version of the pdf file.public void close()
public Content getContent()
public Document getDocument()
public void assertFontNameInDocumentEquals(String expected)
assertFontNameInDocumentEquals
in interface FontAssertion
expected
- A expected font name like "Verdana-BoldItalic".public void assertAllFontNamesInDocument(String[] expected)
assertAllFontNamesInDocument
in interface FontAssertion
expected
- Expected font names like "Verdana-BoldItalic".public void assertFontNameOnPage(String expected, int page)
assertFontNameOnPage
in interface FontAssertion
expected
- A expected font name like "Verdana-BoldItalic".page
- The supposed page number, notice it is 1-based.public void assertAllFontNamesOnPage(String[] expected, int page)
assertAllFontNamesOnPage
in interface FontAssertion
expected
- Expected font names like "Verdana-BoldItalic".page
- The supposed page number, notice it is 1-based.public void assertFontTypeInDocument(String expected)
assertFontTypeInDocument
in interface FontAssertion
expected
- A supposed font type, i.e. "TrueType" or "Type1".public void assertAllFontTypesInDocument(String[] expected)
assertAllFontTypesInDocument
in interface FontAssertion
expected
- All supposed font types in the document. Be carefull
and list all of them. A supposed font type is
i.e. "TrueType" or "Type1".public void assertFontTypeOnPage(String expected, int page)
assertFontTypeOnPage
in interface FontAssertion
expected
- A supposed font type, i.e "TrueType" or "Type1".page
- The supposed page to search for the font type.public void assertAllFontTypesOnPage(String[] expected, int page)
assertAllFontTypesOnPage
in interface FontAssertion
expected
- All supposed font types in the document. Be carefull
and list all of them. A supposed font type is
i.e. "TrueType" or "Type1".page
- The supposed page to search for the font types.public void assertNumberOfBookmarks(int numberOfBookmarks)
public void assertBookmarkExists(String bookmarkName)
public void assertBookmarksAre(String[] bookmarks)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |