I don't know hoe should I make thi unit test, can you please help me?
public void htmlToPdf(final String pHtml, final HttpServletResponse pResponse) throws IOException {
if (pHtml != "") {
final ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString(pHtml);
renderer.setPDFVersion(new Character(PdfWriter.VERSION_1_7));
final ServletOutputStream out = pResponse.getOutputStream();
try {
renderer.layout();
renderer.createPDF(out);
out.flush();
out.close();
} catch (final DocumentException e) {
pResponse.setStatus(500);
} catch (final Exception e) {
pResponse.setStatus(404);
} finally {
if (out != null) {
try {
out.close();
} catch (final IOException e) {
// ignore
}
}
}
}
I don't really know how I have to do it. I need to have 100 coverage..
Aucun commentaire:
Enregistrer un commentaire