On Nov 12, 2007 5:03 PM, Jeff Chastain <[EMAIL PROTECTED]> wrote:

>
> If the DAO object is injected into the service object via ColdSpring, it
> is still a case that I don't have a handle on the mock object in the unit
> test to define its methods before it gets inserted into the service object.


This is the part you're missing. If you have ColdSpring inject the DAO into
the Service, and you also have a reference to ColdSpring in your unit test
file (which you would have to in order for it to create the service for you
to test), you can call getBean('DAO') on ColdSpring and get back a reference
to the same DAO that has been composed into the Service. It's a Singleton.
>From there you can mock out whatever methods you need to, and when your
Service calls the DAO, your mocked methods will return whatever you set them
up to return. Make sense?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Check out the new features and enhancements in the
latest product release - download the "What's New PDF" now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293174
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to