Thanks for looking at this, Ben. I was studying the MockRoundTrip and
that seems like a nice tool with which to test ActionBean classes.
From what I can see there's one problem with MockRoundTrip: I can tell
it the class of the ActionBean I want to test, but I can't pass to it an
instance of an ActionBean. Instead, it seems to rely on creating an
ActionBean instance when the round trip is executed. This doesn't work
for me, as I need to create an instance of the ActionBean myself so I
can set mock collaborators on it. My ActionBeans use Spring beans, and
in my unit tests I mock out these Spring beans with EasyMock and inject
them myself into the ActionBean under test.
Since MockRoundTrip creates an instance of the ActionBean on the fly,
and doesn't let me create my own instance of the ActionBean, I can't set
mock objects on the ActionBean.
Is this correct, and if so, can you recommend any work around?
Thank you!!!
-Ryan
________________________________
From: Ben Gunter [mailto:gunter...@gmail.com]
Sent: Thursday, December 18, 2008 9:49 PM
To: Stripes Users List
Subject: Re: [Stripes-users] RedirectResolution in Unit Tests
I just got done digging a little deeper. The constructor
OnwardResolution(Class) was added on March 13, 2006, and has always
depended on an ActionResolver being available. The good news for me is
that I didn't do it :) The bad news for you is that this isn't likely to
change anytime soon so you should go ahead and make sure you have a
working configuration available. Once you get your test fixture set up,
working with the Stripes mock objects is pretty easy. You can look at
the source for StripesTestFixture
<http://stripes.svn.sourceforge.net/viewvc/stripes/trunk/tests/src/net/s
ourceforge/stripes/StripesTestFixture.java?revision=1000&view=markup>
to get you started. Or you can probably just copy and use it directly.
-Ben
On Thu, Dec 18, 2008 at 6:46 PM, Ben Gunter <gunter...@gmail.com> wrote:
I was looking into this last night. I read the unit testing
information on the Stripes web site, and it does say you should be able
to just create your ActionBeans and test them without using any mock
objects. Between 1.4 and 1.5 some new features were added that
introduced dependencies on the configuration into some classes that had
previously not depended on it. I'm not sure if it will be possible in
the future to test your ActionBeans this way, but I will look into it
further. In the meantime, you should look into making a Configuration
object available via StripesFilter. This might mean you have to use the
mock objects for now. Take a look at the unit testing docs
<http://www.stripesframework.org/display/stripes/Unit+Testing> on the
Stripes site for more information on how to do that.
-Ben
On Thu, Dec 18, 2008 at 12:09 PM, Asleson, Ryan
<asle...@biworldwide.com> wrote:
In my unit tests I'm creating my ActionBeans simply by
using the "new"
operator:
MyActionBean actionBean = new MyActionBean();
Should they be created another way?
-----Original Message-----
From: Mike McNally [mailto:emmecin...@gmail.com]
Sent: Thursday, December 18, 2008 9:51 AM
To: Stripes Users List
Subject: Re: [Stripes-users] RedirectResolution in Unit
Tests
On Thu, Dec 18, 2008 at 9:28 AM, Asleson, Ryan
<asle...@biworldwide.com>
wrote:
>
> Does anybody have any insight on this?
How are you launching your action beans in your unit
tests?
Specifically, is it through the Stripes "Mock"
facilities?
--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------
------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in
Las Vegas,
Nevada.
The future of the web can't happen without you. Join us
at MIX09 to
help pave the way to the Next Web now. Learn more and
register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
<http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix
.com/>
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
This e-mail message is being sent solely for use by the
intended recipient(s) and may contain confidential information. Any
unauthorized review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please contact the sender by phone
or reply by e-mail, delete the original message and destroy all copies.
Thank you.
------------------------------------------------------------------------
------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in
Las Vegas, Nevada.
The future of the web can't happen without you. Join us
at MIX09 to help
pave the way to the Next Web now. Learn more and
register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.
com/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users
This e-mail message is being sent solely for use by the intended recipient(s)
and may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by phone or reply by e-mail, delete the
original message and destroy all copies. Thank you.
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users