|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
de.oio.jpdfunit.DocumentTestCase
public abstract class DocumentTestCase
The DocumentTestCase class is the basic class for your own tests. For implementing own tests extending the DocumentTestCase class you have to provide a getDataSource() method where you return your DocumentDataSource ie. a "PdfDataSource".
Constructor Summary | |
---|---|
DocumentTestCase(String name)
|
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 |
assertDecryptWithOwnerPasswd(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 |
assertDecryptWithUserPasswd(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 exspected)
The method comapares the supposed document title of the document informations with the document title of the document. |
void |
assertEncryptionLenghthEquals(int exspected)
The method compares the supposed encryption length with the encryption length of the document if it is encrypted else it returns 0. |
void |
assertFontNameInDocument(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)
The method compares the supposed owner password with the owner password if it exists of the document. |
void |
assertIsUserPasswd(String expected)
The method compares the supposed user password with the user password if it exists of the document. |
void |
assertKeywordsEquals(String exspected)
The method compares the supposed keywords to the keywords of the document informations of the document. |
void |
assertNumberOfBookmarks(int numberOfBookmarks)
|
void |
assertPageCount(int exspected)
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. |
protected abstract DocumentDataSource |
getDataSource()
A must have if you want to extend the DocumentTestCase therefore you need a DocumentDataSource. |
DocumentTester |
getTester()
The method returns the used DocumentTester of the DocumentTestCase. |
protected void |
onSetup()
If you would like to perform some additional steps. |
protected void |
setUp()
The setUp method of the JUnit framework. |
protected void |
setUpTestingDocument(DocumentDataSource source)
The method instanciates the DocumentTester for the DocumentTestCase. |
protected void |
tearDown()
A must have for a testcase. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DocumentTestCase(String name)
name
- Constructs a test case with the given name.Method Detail |
---|
public void assertAuthorsNameEquals(String expected)
expected
- The expected authors name, the methods checks if the expected
value equals the authors name of the file.public void assertContentContainsText(String text, TextSearchType type)
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)
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)
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)
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)
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)
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)
expected
- The supposed creator of the document.public void assertCreationDateEquals(Calendar expected)
expected
- The expected creation date of the document. It will be
compared to the creation date of the document.public void assertDecryptWithOwnerPasswd(String expected)
expected
- The supposed owner password. This method tries to decrypt the
file with this password.public void assertDecryptWithUserPasswd(String expected)
expected
- The supposed user password. This method tries to decrypt the
file with this password.public void assertDocumentTitleEquals(String exspected)
exspected
- The expected document title, the methods checks if the
expected value equals the document title of the file.public void assertEncryptionLenghthEquals(int exspected)
exspected
- The expected encryption length, the method checks if the
expected value equals the encryption length of the file.public void assertKeywordsEquals(String exspected)
exspected
- The expected keywords, the method checks if the expected
keywords equals the keywords of the file.public void assertPageCount(int exspected)
exspected
- The expected page count. The method checks if the expected
page count equals the page count of the file.
The page count is 1-based.public void assertSubjectEquals(String expected)
expected
- The expected subject, the method checks if the expected
subject equals the subject of the file.public void assertIsDocumentEncrypted(boolean expected)
expected
- Expected has to be set to "true" if you suppose that the
document is encrypted.public void assertIsOwnerPasswd(String expected)
expected
- The expected owner password. The method compares the expected
owner password to the owner password of the file. This is
necessary for changing the document attributes.public void assertIsUserPasswd(String expected)
expected
- The expected user password. The method compares the expected
user password to the user password of the file. This is
necessary for reading the file.public void assertVersionEquals(float expected)
expected
- The expected version of the file. The method checks if the
expected version equals the version of the file.public void assertFontNameInDocument(String expected)
expected
- A expected font name like "Verdana-BoldItalic".public void assertAllFontNamesInDocument(String[] expected)
expected
- Expected font names like "Verdana-BoldItalic".public void assertFontNameOnPage(String expected, int page)
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)
expected
- Expected font names like "Verdana-BoldItalic".page
- The supposed page number, notice it is 1-based.public void assertFontTypeInDocument(String expected)
expected
- A supposed font type, i.e. "TrueType" or "Type1".public void assertAllFontTypesInDocument(String[] expected)
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)
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)
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.protected void onSetup()
protected final void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected abstract DocumentDataSource getDataSource()
protected void setUpTestingDocument(DocumentDataSource source)
source
- This method sets up the inital tester for handling the
file. The kind of tester depends on the DocumentDataSource.protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
public DocumentTester getTester()
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 |