You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy Law <an...@roslin.ed.ac.uk> on 2009/02/02 11:22:01 UTC
My tests fail in 2.1.6 - can someone help?
All,
I've hit a painful problem as I try to migrate to 2.1.6 (from 2.0.14).
I have a class that extends ActionSupport and which calls getText() from
within a routine. I want to test the routine to ensure that it is working
properly. My test runs fine when I compile with 2.0.14 but disappears into a
morass of mock object hell under 2.1.6.
The routine to be tested is simple enough. and is reproduced below...
<code>
public String getTitle() {
String retVal = "";
String key = this.getTitlePropertyKey();
if ( key != null) {
retVal = getText(key + ".title");
}
return retVal;
}
</code>
The test compares a value in a test resource file with the value being
returned.
If I try to run this under 2.1.6, I discover that in order to call getText
in an ActionSupport object, I have to provide a Context object and a Locale
and ValueStack and a Container and an XWorkConverter (that I can't mock
because it isn't an interface and can't create because it has a protected
constructor)...
This is really making me cross. Can anyone provide some clues as to how to
get this test to work or a suggestion as to how to better refactor the whole
thing to fit 'The Struts Way'?
Later,
Andy
--
View this message in context: http://www.nabble.com/My-tests-fail-in-2.1.6---can-someone-help--tp21787233p21787233.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
FIXED - My tests fail in 2.1.6 - can someone help?
Posted by Andy Law <an...@roslin.ed.ac.uk>.
Andy Law wrote:
>
> 've hit a painful problem as I try to migrate to 2.1.6 (from 2.0.14).
>
> I have a class that extends ActionSupport and which calls getText() from
> within a routine. I want to test the routine to ensure that it is working
> properly. My test runs fine when I compile with 2.0.14 but disappears into
> a morass of mock object hell under 2.1.6.
>
>
Apologies: I should have searched harder before shouting. The answer is at
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-UpdateUnitTests
(or at http://tinyurl.com/b6b4v5)
Later,
Andy
--
View this message in context: http://www.nabble.com/My-tests-fail-in-2.1.6---can-someone-help--tp21787233p21788755.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org