13.8.  Error Messages

Error messages of PDFUnit provide detailed information to support bug fixing. And they are as clear and expressive as possible. A message for an incorrect page size demonstrates this intention:

Wrong page format in 'multiple-formats-on-individual-pages.pdf' on page 1. 
Expected: 'height=297.00, width=210.00 (as 'mm')', 
but was:  'height=209.90, width=297.04 (as 'mm')'.

The position of an error is marked by the double brackets <[ and ]>. To keep error messages readable, long values are shortened. The number of dropped characters is indicated as a number in the text surrounded by '...', e.g.:

The expected content does not match the JavaScript in 'javaScriptClock.pdf'. 
Expected: '//<[Thisfileco...41...dbyPDFUnit]>', 
but was:  '//<[Constantsu...4969...);break;}}]>'.

Two XML structures are compared internally using XMLUnit (http://xmlunit.sourceforge.net). XMLUnit's original error message is also shown by PDFUnit:

Content of 'pdf_withDifference.xml' does not match field infos in 'pdfDemo.pdf'. 
Message from XMLUnit ==>
  org.custommonkey.xmlunit.Diff [different] 
  Expected number of child nodes '1' but was '102' - 
  comparing <fieldlist...> at /fieldlist[1] to <fieldlist...> at /fieldlist[1]
<== Extract field infos and compare them with a diff tool against your file.