On 25 Nov 2013, at 9:00, Cédric Beust ♔ wrote:
On Mon, Nov 25, 2013 at 5:51 AM, Brian Pontarelli
<[email protected]>wrote:
Cédric,
Assuming you don't use setters, how do you test without an injector
or
hacked up reflection?
Why would I test without an injector? That's the whole point.
Actually, if you're testing with an injector, you're potentially just
doing integration testing where you think you're doing unit testing.
Though I think, given TestNG's style, you use Guice support in TestNG to
stage the dependencies so as to achieve isolation. Personally, I prefer
to NOT use guice to do unit testing at all, so the test is far less
magic-seeming, all the fake/mock/stub dependencies are created right in
the test where you can see them, not behind the scenes. But that's a
style choice, and if you have rather huge objects with lots of
dependencies, that can be burdensome. Then again, to me that situation
is also a code smell…
c.
Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
Injection
email: [email protected] :::: mobile: +1 (646) 807-9839
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.