Depends upon what's being tested, I guess.  I do both: 'hard-wire' if
necessary testing Providers and their support innards; inject into the
Integration tests to verify all the underlying wiring is as it should
be.  If I'm testing my framework against multiple 3rd party components
(Various JMS providers, for instance) for compatibility and/or
performance, then definitely I'm injecting into tests; ditto for
different Transaction, Session management, Thread related, etc..
strategies.  I'm sure there's a gazillion different answers for this
question. :-)


On Mar 3, 10:37 am, David Stanek <[email protected]> wrote:
> On Wed, Mar 3, 2010 at 1:00 PM, bklough <[email protected]> wrote:
> > Perhaps I missed something, but I believe all you need is:
>
> >    injector.injectMembers(this);
>
> > in your test class right after acquiring the injector instance (before
> > the commented template = injector.getInstance(...) line).  This will
> > fullfil the injection requests in the test itself.  I use a base test
> > class that does the equivalent for injecting loggers, Sessions, etc..,
> > so there shouldn't be a ton of boilerplate.
>
> Is using an injector in tests common practice? I would have thought
> that hand wiring would be more popular.
>
> --
> David
> blog:http://www.traceback.org
> twitter:http://twitter.com/dstanek

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to