How do I just use my own GuiceModule?

6 views
Skip to first unread message

rickcr

unread,
Mar 3, 2009, 9:04:09 PM3/3/09
to atunit
I'm a bit confused on how to best set up my tests that can leverage an
existing guice module..

public class MyGuiceModule extends AbstractModule {
@Override
protected void configure() {
//my stuff
}
}

I'm looking at the examples provided and I see an example where I can
implement Module, but I don't want to have to implement configure, I
just want to use my already defined GuiceModule. What's the best way
to do this? (I'm not using JMock either.)

Thanks

Logan Johnson

unread,
Mar 3, 2009, 9:37:28 PM3/3/09
to atu...@googlegroups.com
Implement Module, and in configure() install your own Module:

@RunWith(AtUnit.class)
@Container(Container.Option.GUICE)
public class MyTest implements Module {

public void configure(Binder b) {
b.install(new MyGuiceModule());
}

}

Rick

unread,
Mar 3, 2009, 9:39:23 PM3/3/09
to atu...@googlegroups.com
Cool thanks. I'll just do that it in a BaseTest class that my Test
classes extend.
--
Rick R
Reply all
Reply to author
Forward
0 new messages