On 06/29/2013 03:13 PM, William Speirs wrote:

Hi Bill,
I'm strongly leaning towards the best practice of: If you're having to
create an injector in your unit test, then you're doing it wrong.

me too. well, normally.
i came to the idea, that UI-Tests are not stricly unit-tests in most of the cases anyway, so i'd consinder this rule to be in the "depends"-area.

anyway, what you could do is to have constructor-"injection" for your tests while using the guice-provided at runtime. on the other hand,
you certainly dont want have this in your code everywhere:

new Link<Void>("link",someServiceInstance){...}

as this makes you code hard to change.
if you'd test the Link in isolation that'd be perfect, but given this link is in a panel, in a panel, in a panel, in a panel of your page, dependency passing becomes ridiculous...

Am I totally wrong here? Am I missing something? I'd love people's
feedback on this!

stomach feeling: i am with you avoiding guice in unit tests. for wicket-tests it is hard, and pollutes the production code more than it helps, imho.

cu uwe

To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to