java – JUnit testcases for PDF File – Education Career Blog

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.

,

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

,

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.

Leave a Comment