Brilliant, I suppose that ".... you can have struts.xml in test/resources with struts.objectFactory = struts" will solve my issue.
Thank you very much. Pozdrawiam/Best regards, Damian Błażejewski dblazejewski.com 2013/11/28 Lukasz Lenart <lukaszlen...@apache.org> > Ok, I get it what do you want ;-) > > Take a look on StrutsSpringObjectFactory, you can try to cheat it by > defining ApplicationContext in ServletContext: > > servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, > mockWebAppContext); > > or you can have struts.xml in test/resources with struts.objectFactory = > struts > > > Regards > -- > Łukasz > + 48 606 323 122 http://www.lenart.org.pl/ > > 2013/11/28 Damian Blazejewski <damian.blazejew...@gmail.com>: > > Lukasz, > > > > Mockito is what I am going to use. > > But how to deal with those Spring dependencies in the action? > > As I said before, when I extend StrutsJUnit4TestCase I get the following > > error: > > "Looks like the Spring listener was not configured for your web app! " > > On the other hand, extending StrutsSpringJUnit4TestCase I have to provide > > Spring context. > > > > No I am thinking about using this: > > https://bitbucket.org/kubek2k/springockito/wiki/Home > > > > It should solve my problem. > > > > > > Pozdrawiam/Best regards, > > Damian Błażejewski > > dblazejewski.com > > > > > > 2013/11/28 Lukasz Lenart <lukaszlen...@apache.org> > > > >> Yes, use mocks -> Mockito > >> > >> > >> Regards > >> -- > >> Łukasz > >> + 48 606 323 122 http://www.lenart.org.pl/ > >> > >> 2013/11/28 Damian Blazejewski <damian.blazejew...@gmail.com>: > >> > I don't want to extend StrutsSpringJUnit4TestCase as it enforces me to > >> > provide all Spring dependencies required by the action itself. > >> > Although the Struts Action I want to test is dependent only on two > Spring > >> > beans, those beans have a lot of other dependencies and so on. > >> > What I would like to do is mocking all Struts Action dependencies and > >> then > >> > doing some tests. > >> > Is it possible to do it that way? > >> > > >> > > >> > Pozdrawiam/Best regards, > >> > Damian Błażejewski > >> > dblazejewski.com > >> > > >> > > >> > 2013/11/27 Lukasz Lenart <lukaszlen...@apache.org> > >> > > >> >> 2013/11/26 Damian Blazejewski <damian.blazejew...@gmail.com>: > >> >> > I have managed to sort it out. My project has two maven modules and > >> one > >> >> > parent pom common for those modules. > >> >> > Tests are located in on of the submodules. > >> >> > As turns out, when I add servlet-api and jsp-api dependencies to > the > >> >> parent > >> >> > pom, the error is present. > >> >> > However, when I move those two dependencies to the module's pom > which > >> >> tests > >> >> > are located in, error disappears. > >> >> > So that problem is solved. > >> >> > Unfortunately, there is another issue. I have almost given up but > my > >> >> desire > >> >> > to start automatically testing Struts actions is stronger so I > still > >> >> > struggle :) > >> >> > I have Spring dependencies in the actions itself. It would be > perfect > >> if > >> >> I > >> >> > could mock them. But as far as I know I can't but I should provide > >> spring > >> >> > application context > >> >> > defining those dependencies. > >> >> > > >> >> > When I try to extend StrutsJUnit4TestCase in my test I get the > >> following > >> >> > error: > >> >> > > >> >> > "Looks like the Spring listener was not configured for your web > app! " > >> >> > > >> >> > When I extend StrutsSpringJUnit4TestCase, I have to provide Spring > >> >> > dependencies as I said earlier. > >> >> > > >> >> > Is there any way to mock those Spring dependencies in my Struts > >> action? > >> >> > >> >> I'm not sure if I understand you - why don't you use > >> >> StrutsSpringJUnit4TestCase? > >> >> > >> >> > >> >> > >> > http://struts.apache.org/release/2.3.x/docs/struts-2-junit-plugin-tutorial.html > >> >> http://struts.apache.org/release/2.3.x/docs/testing-actions.html > >> >> > >> >> > >> >> Regards > >> >> -- > >> >> Łukasz > >> >> + 48 606 323 122 http://www.lenart.org.pl/ > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> >> For additional commands, e-mail: user-h...@struts.apache.org > >> >> > >> >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > >> For additional commands, e-mail: user-h...@struts.apache.org > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >