2

I want to test my Guice modules and I managed to do it for modules containing bindings only. Now I'm wondering how to test this kind of module?

class ModuleA extends AbstractModule {
    @Override
    protected voir configure() {
        Names.bindProperties(binder(), new ModuleAProperties());
        install(new ModuleB());
    }
}
  1. How to test bindProperties()?
  2. How to test install()?
Sigma6
  • 203
  • 4
  • 12
  • 1
    Possible duplicate: http://stackoverflow.com/questions/2448013/how-test-guice-injections – Asaf Sep 30 '13 at 12:59

1 Answers1

4

Since guice is the framework you are using, you certainly dont want to test install() or bindProperties(). You are interested in the result of those operations.

So create a Test, create an injector in the @Before method and then test what values/instances you get with your module configuration.

Jan Galinski
  • 11,768
  • 8
  • 54
  • 77