struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damian Blazejewski <damian.blazejew...@gmail.com>
Subject Re: Struts 2 Testing Actions
Date Tue, 26 Nov 2013 20:38:44 GMT
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?

Thank you in advance for any advice.

Pozdrawiam/Best regards,
Damian Błażejewski
dblazejewski.com


2013/11/26 Lukasz Lenart <lukaszlenart@apache.org>

> 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 <damian.blazejewski@gmail.com>:
> > 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:
> >
> >         <dependency>
> >             <groupId>junit</groupId>
> >             <artifactId>junit</artifactId>
> >             <version>4.8.2</version>
> >             <scope>test</scope>
> >         </dependency>
> >
> >         <dependency>
> >             <groupId>org.apache.struts</groupId>
> >             <artifactId>struts2-junit-plugin</artifactId>
> >             <version>${struts.version}</version>
> >             <scope>test</scope>
> >         </dependency>
> >
> >         <dependency>
> >             <groupId>org.javassist</groupId>
> >             <artifactId>javassist</artifactId>
> >             <version>3.16.1-GA</version>
> >         </dependency>
> >
> >         <dependency>
> >             <groupId>javax.servlet</groupId>
> >             <artifactId>servlet-api</artifactId>
> >             <version>2.5</version>
> >             <type>jar</type>
> >             <scope>test</scope>
> >         </dependency>
> >         <dependency>
> >             <groupId>javax.servlet.jsp</groupId>
> >             <artifactId>jsp-api</artifactId>
> >             <version>2.2</version>
> >             <type>jar</type>
> >             <scope>test</scope>
> >         </dependency>
> >
> > Pozdrawiam/Best regards,
> > Damian Błażejewski
> > dblazejewski.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message