I have a UIComponent object. I would like to get the HTML code generated by this component at runtime so I can analyze it.
Is there a way to achieve this?
I am trying to use JsfUnit to create automated tests. I can get ahold of the UICompoment objects from within the test methods. However, I couldn't find a way to check the Html generated by the component.
Just do the same what JSF does under the covers: invoke
UIComponent#encodeAll(). To capture the output, set the response writer to a local buffer byFacesContext#setResponseWriter().E.g. (assuming that you're sitting in invoke application phase; when sitting in render response phase, this needs to be done differently):