You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mael Le Guével <le...@gmail.com> on 2013/06/04 14:53:14 UTC

Testing with xslt result type + spring

Hello,
I am trying to write unit tests for an action that uses xslt result
type with struts 2.3.4.1
I am using a XSLT file located in WEB-INF to render the result (the
location is something like: /WEB-INF/xslt/myfile.xsl).  That works.
But I cannot figure out how I can test the action. I would like to
control the result (XML) of my action.

I usually use the class org.apache.struts2.StrutsSpringJUnit4TestCase
with SpringJUnit4ClassRunner to test my actions but it does not seem
to work for XSLT.
It actually fails on the line 438 of org.apache.struts2.views.xslt.XSLTResult:

URL resource = ServletActionContext.getServletContext().getResource(path);

ServletActionContext.getServletContext() returns a spring
MockServletContext which does not seem to be able to retrieve a
resource relative to the context path.

Has anyone succeeded in testing xslt result type in this kind of situation?

Thanks :)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org