Re: [unit testing] Suggestions for unit tests for HtmlRenderer

2017-02-02 Thread Justin Edelson
Hi Matt, IIRC, you need to call the setup method to pass in a response object. The renderer then gets the writer from the response object. Regards, Justin On Thu, Feb 2, 2017 at 3:57 PM Matt Ryan wrote: > Hi Justin, > > Thanks for your reply. But I'm still not seeing how to go about solving >

Re: [unit testing] Suggestions for unit tests for HtmlRenderer

2017-02-02 Thread Matt Ryan
Hi Justin, Thanks for your reply. But I'm still not seeing how to go about solving this. Where I get stuck is how to get the HtmlRenderer to use my writer. It has a private PrintWriter field inside it, which as best I can tell is never actually initialized. If I just create a new HtmlRenderer(

Re: [unit testing] Suggestions for unit tests for HtmlRenderer

2017-02-01 Thread Justin Edelson
Hi Matt, Thanks for adding tests!!! What I would suggest is to mock the HttpServletResponse and provide a your own StringWriter to response.getWriter(). Regards, Justin On Wed, Feb 1, 2017 at 4:26 PM Matt Ryan wrote: > Hi, > > I'm trying to add unit tests for > org.apache.sling.junit.impl.serv

[unit testing] Suggestions for unit tests for HtmlRenderer

2017-02-01 Thread Matt Ryan
Hi, I'm trying to add unit tests for org.apache.sling.junit.impl.servlet.HtmlRenderer. However, I'm not sure the best way to verify that the correct behavior has occurred for the public methods. Each public method takes action on a private field - a PrintWriter instance - but I'm not seeing any