Re: Struts 2 Testing Actions

2013-11-28 Thread Damian Blazejewski
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 > Ok, I get it what do you want ;-) > > Take a look on

Re: Struts 2 Testing Actions

2013-11-28 Thread Lukasz Lenart
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/re

Re: Struts 2 Testing Actions

2013-11-27 Thread Damian Blazejewski
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 StrutsSpringJ

Re: Struts 2 Testing Actions

2013-11-27 Thread Lukasz Lenart
Yes, use mocks -> Mockito Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/11/28 Damian Blazejewski : > 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

Re: Struts 2 Testing Actions

2013-11-27 Thread Damian Blazejewski
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 m

Re: Struts 2 Testing Actions

2013-11-27 Thread Lukasz Lenart
2013/11/26 Damian Blazejewski : > 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. >

Re: Struts 2 Testing Actions

2013-11-26 Thread Damian Blazejewski
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

Re: Struts 2 Testing Actions

2013-11-25 Thread Lukasz Lenart
What Struts version do you use? And can you post source of the test? Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/11/24 Damian Blazejewski : > Hello, > > I have a problem executing Struts 2 action test case. > I get the following error: > > > *Absent Code attribute in metho

Struts 2 Testing Actions

2013-11-24 Thread Damian Blazejewski
Hello, I have a problem executing Struts 2 action test case. I get the following error: *Absent Code attribute in method that is not native or abstract in class file javax/servlet/jsp/PageContext * I have no clue what can be wrong. Thank you in advance for your help. Here are my dependencies: