Providers.of() is convenient for this: http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/util/Providers.html#of(T)
If you're testing only one class, then typically use of the Injector is overkill. Fred On Sat, Apr 9, 2011 at 4:20 AM, Ido Ran <[email protected]> wrote: > Hi, > I am wondering how to unit test a class which has dependency on > Provider<T>? > I rather not use Injector in the unit test so does it means I have to mock > Provider<T> ? or it there other way? > Also does the use of Injector is good or not so good in a unit test? > > Thank you, > Ido. > > -- > 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. > -- 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.
