CONNER, BRENDAN (SBCSI) asked:
> Sent: Thursday, February 16, 2006 1:08 PM
> To: Struts Users Mailing List
> Subject: RE: [SHALE] Using the Test Framework
> 
> 
> OK, so maybe I have to learn more about the injection 
> process.  For all this talk about simplifying the process, 
> it's starting to get complicated, but, hey, I'm flexible. ;-)
> 
> Can someone point me to a resource that would explain this in 
> more detail?  It sounds like I have to create a bunch of 
> alternate delegates (that return different test values) to 
> swap into place when testing my JSF Action method.  Is that the idea?

Pretty much.  If your delegate API is defined as an interface, then it's
easy to create a mock or stub that implements that interface.  There are
even packages that will do it on the fly (EasyMock, for example).  You
can also do things like subclass your delegate and override certain
methods that might require container services.

Then you just need to have a way to insert these in place of the
production delegates.  If you're using dependency injection (a.k.a.
inversion of control) then you can inject them by that method.  If
you're using an abstract factory pattern, you can substitute a test
factory for the production factory.

 - George

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to