tags:

views:

24

answers:

2

My java program writes information on PDF form. Does anyone know a good way to write test cases using JUnit to make sure it has printed the required information on PDF form.

+1  A: 

Do you create the PDF with code you've written, or do you use a third-party PDF library?

If the latter, you shouldn't be testing this. You should assume the library works, and just test whether you make the right calls to it by mocking/stubbing it out.

dty
I use third-party PDF library.
yogsma
... if you're writing a unit test. If you're doing integration testing the OP's use case is valid
rjohnston
+4  A: 

Use the same library you are using to write to the PDF form to look for the expected results in the pdf form

Aaron Saunders