I have written my first application using guice.

  public static void main(String[] args) {

    // We need to pass the input to the dependencies.
    Injector injector = Guice.createInjector(new MyGuiceAppModule
(args));
    MyGuiceApp app = injector.getInstance(MyGuiceApp.class);
    app.start()
}

Where I make the necessary bindings in the MyGuiceAppModule.

Now I would like to test some methods in the MyGuiceApp class which
looks like this:


public class MyGuiceApp {
  private MyInterfaceA a,

  @Inject
  public MyGuiceApp(
      MyInterfaceA a,
      MyInterfaceB b,
      MyInterfaceC c,
      @Named("input_file") String inputfile)
  {
    this.a = a;
    // ...

  }

  public in method1(){

    // do stuff
  }

}


But are there any "smart" way to do this without having to create a
separate module where I make eg. mock or fake bindings?

I have looked at:

http://code.mycila.com/wiki/MycilaTesting
http://code.google.com/p/guiceberry/

But it seems that these frameworks are more aiming at writing test
using eg guice instead of actually making it easier to test an already
existing guice application.

Any hints on testing "simple" guice applications are most welcome!

-- 
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