| test.pdfbox.util.TestTextStripper
TestTextStripper | public class TestTextStripper extends TestCase (Code) | | Test suite for PDFTextStripper.
FILE SET VALIDATION
This test suite is designed to test PDFTextStripper using a set of PDF
files and known good output for each. The default mode of testAll()
is to process each *.pdf file in "test/input". An output file is
created in "test/output" with the same name as the PDF file, plus an
additional ".txt" suffix.
The output file is then tested against a known good result file from
the input directory (again, with the same name as the tested PDF file,
but with the additional ".txt" suffix).
So for the file "test/input/hello.pdf", an output file will be generated
named "test/output/hello.pdf.txt". Then that file will be compared to
the known good file "test/input/hello.pdf.txt", if it exists.
Any errors are logged, and at the end of processing all *.pdf files, if
there were any errors, the test fails. The logging is at INFO, as the
general goal is overall validation, and on failure, the indication of
which file or files failed.
When processing new PDF files, you may use testAll() to generate output,
verify the output manually, then move the output file to the test input
directory to use as the basis for future validations.
SINGLE FILE VALIDATION
To further research individual failures, the test.pdfbox.util.TextStripper.file
system property may be set with the name of a single file in the "test/input"
directory. In this mode, testAll() will evaluate only that file, and will
do so with DEBUG level logging. You can set this property from ant by
defining "file", as in:
ant testextract -Dfile=hello.pdf
author: Robert Dickinson (bob@brutesquadlabs.com) author: Ben Litchfield version: $Revision: 1.17 $ |
Method Summary | |
public void | doTestFile(File file, boolean bLogResult) Validate text extraction on a single file. | public static void | main(String[] args) Command line execution. | public void | setUp() Test suite setup. | public static Test | suite() Set the tests in the suite for this test class. | public void | testExtract() Test to validate text extraction of file set. |
TestTextStripper | public TestTextStripper(String name) throws IOException(Code) | | Test class constructor.
Parameters: name - The name of the test class. throws: IOException - If there is an error creating the test. |
doTestFile | public void doTestFile(File file, boolean bLogResult) throws Exception(Code) | | Validate text extraction on a single file.
Parameters: file - The file to validate Parameters: bLogResult - Whether to log the extracted text throws: Exception - when there is an exception |
main | public static void main(String[] args)(Code) | | Command line execution.
Parameters: args - Command line arguments. |
setUp | public void setUp()(Code) | | Test suite setup.
|
suite | public static Test suite()(Code) | | Set the tests in the suite for this test class.
the Suite. |
testExtract | public void testExtract() throws Exception(Code) | | Test to validate text extraction of file set.
throws: Exception - when there is an exception |
|
|