Prev |  | Next

## 7.2. A quick Look at PDFUnit-Perl

'PDFUnit-Perl', a version of PDFUnit, contains a Perl module `PDF::PDFUnit` with all necessary scripts. Together with other CPAN modules e.g. `TEST::More` or `Test::Unit` it is easy to write automated tests, which are 100% compatible with 'PDFUnit-Java'.

It is intended to upload `PDF::PDFUnit` to the CPAN archive.

Here are two simple examples using `TEST::More` and `PDF:PDFUNIT`:

    #
    # Test hasFormat
    #
    ok(
      com::pdfunit::AssertThat
        ->document("documentInfo/documentInfo_allInfo.pdf")
        ->hasFormat($com::pdfunit::Constants::A4_PORTRAIT)
      , "Document does not have the expected format A4 portrait")
    ;

    #
    # Test hasAuthor_WrongValueIntended
    #
    throws_ok {
      com::pdfunit::AssertThat
        ->document("documentInfo/documentInfo_allInfo.pdf")
        ->hasAuthor()
        ->equalsTo("wrong-author-intended")
    } 'com::pdfunit::errors::PDFUnitValidationException'
    ,"Test should fail. Demo test with expected exception."
    ;

A separate documentation covers PDFUnit-Perl.

Prev | Up | Next
Chapter 7. PDFUnit for Non-Java Systems | Home | 7.3. A quick Look at PDFUnit-XML