For a long time I have been working on a series of automated tests that rely on the creation of mocks through a service lookup utility (like Spring framework's), which in some ways resembles a dependency injection framework and is used like a DI framework, but it doesn't quite work the same way, and it has some intricacies that make it less reliable for DI in my opinion. Recently I've been trying to implement the usage of Guice in place of this service lookup utility, and I've been running into a possible issue that I can't seem to figure out. I however suppose that I must be missing something in relation to Guice.
Essentially there are cases when we mock portions of a system and set them up in advance of running that system. Our service lookup utility in this sense seems to be global. In Guice however there seems to be a requirement of concrete implementations of AbstractModule or more correctly the Module interface. It seems to me that all of the examples provided use those implementations explicitly right before requesting an instance of an interface in question. If this is the case, then how would I implement my integration tests using Guice to mock certain portions of a system in advance of calling that system, and ensure that my mocks (in a Module implementation) get used? There isn't any way to do this is there? Because Guice isn't global, or rather the bindings aren't global to the test application or application under test, rather they are local. This is probably a special situation. Can anybody please help me clarify this point? Thanks. Nathan Lane -- 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.
